Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3806492
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:50:39+00:00 2026-05-19T14:50:39+00:00

I wanted to know if there is any event which occurs each time a

  • 0

I wanted to know if there is any event which occurs each time a cache item is about too get expired or any event which is raised when a cache item is getting expired.I am using enterprise library in asp.net for caching.I want to store some data in my database when a cache is about to get expired instead of calling a function or invoking an event myself I was thinking of using the already managed cache library event which is being used to flush or dispose cache items.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:50:40+00:00Added an answer on May 19, 2026 at 2:50 pm

    Assuming you’re using the Caching Application Block then you specify a callback delegate when you add items to the cache.

    Receiving notification of an item’s removal from the cache requires that you specify the class implementing ICacheItemRefreshAction on the call to the Add method

    You need to supply a class implementing ICacheItemRefreshAction:

    [Serializable]
    public class ProductCacheRefreshAction : ICacheItemRefreshAction
    {
      public void Refresh(string key, object expiredValue, CacheItemRemovedReason removalReason)
      {
        // Item has been removed from cache. Perform desired actions here, based on
        // the removal reason (for example, refresh the cache with the item).
      }
    }
    

    As you can see, when an item is removed, this Refresh() method is called with the key and the object that’s being removed. You just need to cast the expiredObject parameter to the correct type and arrange to have it stored to the database.

    As documented here: http://msdn.microsoft.com/en-us/library/ff664621(v=PandP.50).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to know if there is any way to synchronize (or exchanging files)
I just wanted to know, if there is any technique to insert values into
I wanted to know if there is way to log the mysql queries in
Just wanted to know if there is a big chance to inject SQL While
I wanted to know if there's a way I can bind an Asp.net Ajax
I just wanted to know if there is a way on how to remove
I'm playing around with html client side storage and wanted to know if there
I know there are non-standard frameworks such as commons-validator, and hibernate validator. I wanted
Wanted to know if someone had a suggestion on code or maybe there's a
hi guys I wanted to know, is there a way to not display my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.