browse other examples

Cache within datasource implementation

The cache that is implemented here is a facade over standard datasource. So all you need here is to initialize Cache:

Base data retrieving method datasource.get() isn't changed. It may has any implementation like no any cache is presented.

You may disable/enable Cache programmatically:

datasource.cache.isEnabled = true;
Toggle-link demonstrates this ability. You can see the difference between cache and no-cache modes because of $timeout back-end delay emulation on datasource.get.

Cache is {{datasource.cache.isEnabled ? 'enabled' : 'disabled'}} [toggle]