Skip to main content
Bumped by Community user
improved formatting
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Using the steps explained here:on https://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7A Beginner's Guide to Caching Data in Drupal 7, I'm storing an array with a specified expiryexpiration time.

But what is happening is that even after expiry of time, the cache_get() is still returning the stale cache, when the expiration time is passed. Even cron runCron is not deleting the cache entry. (I've checked the cache_blockcache_block table).)

This is the code: I am using.

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends
$out = &drupal_static(__FUNCTION__);
        
if (!isset($out)) {
  if (($cache = cache_get(__FUNCTION__,'cache_block'))) {
    $out = $cache->data;
    dsm("cache returned");
  }
  else {
    // Do something.
    $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
    cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
  }
}
    
return $out;

Only "cache clear all" in the PerformancePerformance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:.

Expired entries will be automatically discarded as they pass that date date.

But thatThat does not seem to be happening. Alsohappen, although I've verified that the "expire" value in the cache table is beyond the current time.

I can clear the cache myself, but then the cache_get() function does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained here: https://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7, I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even cron run is not deleting the cache entry (I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only "cache clear all" in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But that does not seem to be happening. Also, I've verified that the "expire" value in the cache table is beyond the current time.

I can clear the cache myself, but then the cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained on A Beginner's Guide to Caching Data in Drupal 7, I'm storing an array with a specified expiration time.

cache_get() is still returning stale cache, when the expiration time is passed. Even Cron is not deleting the cache entry. (I've checked the cache_block table.)

This is the code I am using.

$out = &drupal_static(__FUNCTION__);
        
if (!isset($out)) {
  if (($cache = cache_get(__FUNCTION__,'cache_block'))) {
    $out = $cache->data;
    dsm("cache returned");
  }
  else {
    // Do something.
    $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
    cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
  }
}
    
return $out;

Only "cache clear all" in the Performance tab is clearing this cache entry.

In that article I can read this.

Expired entries will be automatically discarded as they pass that date.

That does not seem to happen, although I've verified that the "expire" value in the cache table is beyond the current time.

I can clear the cache myself, but then cache_get() does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7https://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7, I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_getcache_get is returning the stale cache. Even Croncron run is not deleting the cache entry  (I've checked the cache_blockcache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only cache"cache clear allall" in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But that does not seem to be happening. Also, I've verified that the "expire" value in the cache table is beyond the current time.

I can clear the cache myself, but then cache_getthe cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7 I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even Cron run is not deleting the cache entry(I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only cache clear all in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But does not seem to be happening. Also I've verified that "expire" value in the cache table is beyond current time.

I can clear the cache myself but then cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained here: https://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7, I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even cron run is not deleting the cache entry  (I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only "cache clear all" in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But that does not seem to be happening. Also, I've verified that the "expire" value in the cache table is beyond the current time.

I can clear the cache myself, but then the cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Removed the + 2 which I used for testing only.
Source Link
user5858
  • 264
  • 1
  • 2
  • 14

Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7 I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even Cron run is not deleting the cache entry(I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', timestrtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only cache clear all in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But does not seem to be happening. Also I've verified that "expire" value in the cache table is beyond current time.

I can clear the cache myself but then cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7 I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even Cron run is not deleting the cache entry(I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', time()+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only cache clear all in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But does not seem to be happening. Also I've verified that "expire" value in the cache table is beyond current time.

I can clear the cache myself but then cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7 I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even Cron run is not deleting the cache entry(I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);
    
        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '<ul style="list-style:none;padding-right:20px">' . $out . "</ul>";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only cache clear all in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

Expired entries will be automatically discarded as they pass that date.

But does not seem to be happening. Also I've verified that "expire" value in the cache table is beyond current time.

I can clear the cache myself but then cache_get function does not return the "expire" time in the table.

Anything I'm missing here?

added 328 characters in body
Source Link
user5858
  • 264
  • 1
  • 2
  • 14
Loading
Source Link
user5858
  • 264
  • 1
  • 2
  • 14
Loading