Data Dependency in Cache
Databases store data based on a relational model where tuples or relational groups represent it. Entities within this database map with other entities based on the previously mentioned relational model, demonstrating their dependency on each other.
When stored in a cache, there is no data dependency, the data has no relational model and exists as a key-value pair. So the items have no model to figure out the dependent cache items. Thus, to provide cache dependency, NCache offers various techniques letting users provide dependencies of singular items on others and vice versa.
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 object, such that any change within can invalidate the data in the cache. In that case, all dependent data must be reloaded or removed from the cache - preventing data from going stale.
Since the data enters the cache in serialized form, the dependent item cannot update itself according to updates occurring in the item on which it is dependent. The dependent item leaves the cache on two kinds of write operations which are:
- Update Operation
- Remove Operation
This mechanism helps reduce the server load and improves the efficiency of the application for the user.
In This Section
Single Cache Key Dependency
Explains how to add data using Key Dependency.
Multi Cache Key Dependency
Explains how to synchronize data among different caches to ensure data integrity.