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 9082001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:27:06+00:00 2026-06-16T20:27:06+00:00

I would like to cache a node individually based on the published date of

  • 0

I would like to cache a node individually based on the published date of the node. Older nodes could be cached longer than newer nodes. I thought I could cache using cache_set individually but realized that nodes are cached by default and so it could be better to set an expiry time on the cache. Any thoughts on how to do this? A hook perhaps?

  • 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-06-16T20:27:07+00:00Added an answer on June 16, 2026 at 8:27 pm

    Drupal does not have a node cache per se. If you have the page cache turned on for anonymous users, the cahced data for nodes is likely spread across three tables:

    1. cache_content

      This table caches the values of fields that are not passed through an input filter such as file_fields or text areas with “Plain Text” selected.

    2. cache_filter

      This table caches the filtered values of Rich Text fields such as Body or a CCK text area with “Rich Text” selected.

    3. cache_page

      This table caches the entire redered page output as seen by anonymous visitors

    I don’t know of a way to dictate exactly when these cache rows expire, so you would have create a function

    If you want to clear all caches for specific nodes based on custom rules, you could use a cache_clear_all function within HOOK_cron to accomplish that. You would first need to determine which nodes meet your criteria for cache deletion, then you could use cache_clear_all with a ‘cid’ wildcard parameter. Something like (this would go inside a HOOK_cron function in your custom module and requires that a proper cron job is set up):

    <?php
    $wildcard = //Your criteria for the cache_content table;
    cache_clear_all($wildcard, 'cache_content', TRUE);
    
    $wildcard = //Your criteria for the cache_filter table;
    cache_clear_all($wildcard, 'cache_filter', TRUE);
    
    $wildcard = //Your criteria for the cache_page table;
    cache_clear_all($wildcard, 'cache_page', TRUE);
    

    I think the main point here is that it’s quite difficult to override Drupal’s build-in cache expiries.

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

Sidebar

Related Questions

I would like to cache a PDF template in a servlet's context. Every time
I would like to cache the computed observable value for certain time (1-2 sec).
I would like to cache my website with memcache as much as possible. There
I am reading a CSV file and I would like to cache the results
i would like to have a simple cache that supports transactions. With simple I
we have a cache which I would like to put some transaction scopes around
I would like to cache some IO with the help of ConcurrentHashMap . The
I have got page which I would like to cache using the OutputCache directive.
I would like to parse an Atom Feed and create an Atom-compliant cache of
I'm new to PHP and Zend, and I would like to cache sensitive data

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.