Data Relationship in Cache
Databases have data stored in them based on a relational model where the data is represented in the form of tuples or relational groups. Entities are mapped with other entities based on this relation model which shows the dependency of entities or items on each other.
When stored in cache, the data has no relational model and is stored in the form of key-value pair. So the items have no model to figure out the dependent cache items. So in order to provide cache dependency various techniques are provided by NCache which allow the user to provide dependency of one item on another.
Data in the cache can have dependency relations with items like an item, a file on some location, a record in a database, results of a particular query or another cached item, such that any change in the item can invalidate the data in the cache. In that case, all dependent data must be reloaded or removed from cache otherwise data will become stale.
Since the data is added in the cache in serialized form; the dependent item cannot update itself according to any update occurred in the item it is dependent on. The dependent item is removed from the cache on two kinds of write operations which are:
This helps in reducing the server load as well as improving the efficiency of the application for the user.
In This Section
Explains how to add data using key dependency.
Multiple Cache Key Dependency
Explains how to synchronize data among different caches to ensure data integrity.