Peter Hoopes
05/13/2023, 1:47 PMsknowlton
05/13/2023, 4:20 PMgetOrSet()
type helpers and you have a lot more control as you'd expect with a cache. App scope is OK for things that either don't change, or if you can add a lifecycle interception so that it's updated whenever they do change.
3. I don't like storing query objects - I will store mementos of objects (structs and arrays of structs) but I don't find any advantage to storing the actual query, but I also don't like QoQ and reasonable people may like it more than me, particularly now that it's a lot faster than it used to be.Peter Hoopes
05/13/2023, 8:01 PMbdw429s
05/13/2023, 10:33 PMbdw429s
05/13/2023, 10:34 PMbdw429s
05/13/2023, 10:36 PMbdw429s
05/13/2023, 10:37 PMbdw429s
05/13/2023, 10:39 PMIs there a way to have CacheBox (or another routine) regularly update the data in the cache?The semantics for data freshness in a cache is handled by your timeouts. This makes it a little like the light in your fridge-- it's only "on" when you looking at it. So if you want a value to never be older than 2 hours, then you set the timeout expiration to 2 hours. A fresh value will be automatically created the next time someone requests that object from the cache, which may be at 2 hours and 1 minute later, or 10 hours later. There's no need to proactively "update" anything in the cache. Just let it get refreshed automatically as it's hit.
Scott Steinbeck
05/14/2023, 7:09 PM