An implementation of cache at Angular2 (4.0.0-rc.5 compatible).
The cache service supports the following types of caching:
- ZONE based on NgZone (the analogue of Java ThreadLocal) and the MemoryGlobalCache.
The NgZoneGlobalCache service and @ZoneCached decorator are accessible for use.
The zone cache is cleared after the "Zone" area will have finished its work.
The MemoryGlobalCache service and @MemoryCached decorator are accessible for use.
The memory cache is cleared after F5.
- STORAGE based on the Window.sessionStorage (in progress)
- SESSION based on the Window.sessionStorage (in progress)
- FILE based on the chrome.fileSystem (in progress)
- INSTANCE based (in progress)
Also, the zoneCachedDate, memoryCachedDate cached date pipes are accessible now for use.
First you need to install the npm module:
npm install angular2-cache --save
We should integrate the cache providers at first.
Then you should inject the appropriate the cache service (NgZoneGlobalCache, MemoryGlobalCache, etc..). The each cache service has the public methods for setting configuration (setEnableLogging, setEnable or setCachedValue for setting the not lazy presets values).
npm run deploy
Licensed under MIT.