function CacheResource(id, namespace): ClassDecorator;Defined in: storage/storage-resource.ts:70
Decorator which transforms a class into a StorageResource persisted via the Cache API. api and shared across all tabs/windows under the same origin.
CacheResources must either be singletons or expect all instances to share state unless a primary key function is provided.
When a primary key function is provided, each instance will have its own persisted data based on the key generated by the function.
The function will be called once per instance during initialization to determine the unique ID for that instance.
All object cached in the same namespace share the namespace's storage context, so partitioning can be achieved by using different namespaces for different groups of data.
Parameters
id
string | KeyFn
namespace
null | string
Returns
ClassDecorator