---
title: "What is Cache Callback in Cache?"  
description: "What is Cache Callback in Cache?"  
author: "Anonymous User"  
published: 2011-05-23  
updated: 2020-09-17  
canonical: https://www.mindstick.com/interview/1003/what-is-cache-callback-in-cache  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# What is Cache Callback in Cache?

The cache object has dependencies e.g. relationships to the file it stores. Cache items remove the object when these dependencies change. As a work around we would need to simply execute a callback method whenever items are removed from the cache to add the items back in cache.

e.g.: We have a string variable string var="hello" and store it in cache. This item would be removed from the cache if value is changed from "hello" to "bye". In such a case we need to simply right a callback function which would add updated var back in cache as it’s been removed as a result of its dependencies changing.

## Answers

### Answer by Anonymous User

The cache object has dependencies e.g. relationships to the file it stores. Cache items remove the object when these dependencies change. As a work around we would need to simply execute a callback method whenever items are removed from the cache to add the items back in cache.

e.g.: We have a string variable string var="hello" and store it in cache. This item would be removed from the cache if value is changed from "hello" to "bye". In such a case we need to simply right a callback function which would add updated var back in cache as it’s been removed as a result of its dependencies changing.


---

Original Source: https://www.mindstick.com/interview/1003/what-is-cache-callback-in-cache

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
