Cache Dependencies types - Caching pages and data

Q.  How many types of Cache Dependencies are available in ASP.NET?
- Published on 27 Jul 15

a. File based dependencies
b. Key-based dependencies
c. Time-based dependencies
d. All of the above

ANSWER: All of the above


  • Nihal   -Posted on 24 Sep 15
    Cache dependency is a flexible technique that enables you to set the dependency of the cache with some data that can be change. So you can update or remove cache by setting the dependency of cache. There are three types of dependencies supported in ASP.NET:
    • File based dependency
    • Key based dependency
    • Time based dependency
    File Based Dependency: File-based dependency comes in picture when particular cache item change that is stored on the disk. When the file contents changes the Cache is expired and the contents are fetched again.
    Key Based Dependency: If we have saved multiple interrelated objects in the cache and if one of the objects changes, we need to update or expire all of them. Key-based dependency checks a particular cache item when another cache item changes.
    Time Based Dependency: Time-based dependency causes an item to expire at a defined time.

Post your comment / Share knowledge

Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)