Custom Dependency
NCache provides flexible ways to determine data invalidation using various dependencies. However, you can implement your custom logic for dependency if none of the built in invalidation strategies fulfil your own requirements. For example, you can implement a custom dependency which makes a call to a web service for the validation of data.
In custom dependency, you can implement your custom logic which defines when a
certain data becomes invalid. For this purpose, NCache provides an abstract
class ExtensibleDependency
. All you need to do is to inherit your dependency
class from this class and override its HasChanged
property.
Once implemented, place the assembly or executable file of class overriding
ExtensibleDependency
in NCache service folder and restart the cache.
Like expiration, cache clean up thread periodically
calls HasChanged()
property of custom dependency and if it returns true, the
item is removed from the cache.
For more details on implementation of Custom Cache Dependency, please read Custom Cache Dependency in section Server Side API Programming.
See Also
File Dependency
Sync Cache with Database
Data Relationship in Cache