magic.lambda.caching
This project contains caching helper slots for Hyperlambda. More specifically this project provides the following slots.
- [cache.set] - Adds the specified item to the cache
- [cache.get] - Returns a previously cached item, if existing, if not returns nothing
- [cache.try-get] - Attempts to retrieve an item from cache, and if not existing, invokes [.lambda] to create item, saves the resulting item to the cache, before returning the item to caller
- [cache.clear] - Completely empties cache, optionally taking a filter condition
- [cache.list] - Lists all items in cache, optionally taking a filter condition
- [cache.count] - Returns the number of cache items in total, optionally taking a filter condition
All of the above slots requires a key as its value, and/or a filter argument, as the value of the identity node for the invocation of the slot. Notice, the cache can only persist string values, implying if you want to store something else besides a string, you’ll need to correctly convert the object before storing it into your cache, and correctly convert it after extracting it again later. If you need to preserve typing information, you can store Hyperlambda strings into your cache.
Topics
- Hyperlambda caching internals - Internally the cache implementation is not using the MemoryCache from .Net, since this class suffers from a whole range of problems in regards to its API, such as not being able to count or iterate it