cache_set syntax issue
cache_set($id, 'cache', serialize($my_data), time() + 360);
I am setting the cache as above. However 开发者_如何学JAVAit does not set the cache for the specified unix time stamp of 1 day.
$id = id of the cache;
$my_data = data to be cached;
'cache' = table where it is stored;
time() + 360 = unix timestamp;
So finally , the correct syntax should be cache_set($id,$data,'cache',time()+(24*60*60))
But this does not update the cache table. The operation cache_get($id)
also does not execute.
Shots in the dark...
If you are using Drupal 5 that should work fine. Things to remember: $id should be a string.
Format For Drupal 6:
cache_set($id, $my_data, 'cache', time() + 360)
- You don't need to serialize this already happens within cache_set()
精彩评论