πAbout SA5's Cache Lib
About the SA5 Cache Library
SA5 Cache is primarily an internal mechanism within the library, and may become part of SA5 Core. We're considering whether an how to make it accessible and usable by other devs in their projects.
What is SA5 Cache?
This this lib is a tool for JavaScript devs to cache data for quick local access.
It provides;
Key-value caching, where the value is any object
Cookies & webStorage support
Expiry settings for cookies
A cache controller, to manage and retrieve items
The architecture is designed to simplify access;
Instantiate a cache controller
Add an item, which represents a named object
Give it a name
Defined where and how it is stored
Give it a function that can construct the object for storage
Any time you need that data, simply request it from the cache controller. If the object is not available, it will call your function to create it, and then cache the results.
Cache In-Validation Support
SA5 Cache supports a controller-level token, which allows you to invalidate client side caches when application changes are deployed that involve e.g. object structure changes.
Future- complete this and add the clear cache.
Use Cases
Get JSON, CSV, RSS from an endpoint, as rarely as possible
Store any data you want, between user-sessions
Future
Caching tied to User accounts
Intelligent expiry determination, from the server
Last updated