Apologies, Change { /* It was read from persistence */ }
for { /* It needs to be read from persistence */ result = _cache.Get(key); } On Fri, Feb 21, 2025 at 12:39 PM Raymond Wilson <raymond_wil...@trimble.com> wrote: > I am experimenting with some metrics to help us understand how often > Cache.Get() operations are satisfied by returning a value already > existing in memory, versus those that are satisfied by needing to read that > content from the persistent store. > > The way I am attempting to do this is by using TryLocalPeek(), eg: > > if (_cache.TryLocalPeek(key, out var result, CachePeekMode.Onheap, > CachePeekMode.Offheap)) > { /* It was already in memory */ } > else > { /* It was read from persistence */ } > > Oddly, it appears almost all calls are satisfied by the TryLocalPeek() > call, even on a completely cold restarted system. > > Can anyone confirm if my expected behaviour here is correct (and there is > a bug), or if I am 'doing it wrong' and there is a better way? > > Thanks, > Raymond. > > > -- > <http://www.trimble.com/> > Raymond Wilson > Trimble Distinguished Engineer, Civil Construction Software (CCS) > 11 Birmingham Drive | Christchurch, New Zealand > raymond_wil...@trimble.com > > > <https://worksos.trimble.com/?utm_source=Trimble&utm_medium=emailsign&utm_campaign=Launch> > -- <http://www.trimble.com/> Raymond Wilson Trimble Distinguished Engineer, Civil Construction Software (CCS) 11 Birmingham Drive | Christchurch, New Zealand raymond_wil...@trimble.com <https://worksos.trimble.com/?utm_source=Trimble&utm_medium=emailsign&utm_campaign=Launch>