Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi,

We have implemented file driver for caching data, something like below.

Phpfastcache\CacheManager::setDefaultConfig(new Phpfastcache\Config\ConfigurationOption([
    "path" => "/tmp/",
]));
$InstanceCache = Phpfastcache\CacheManager::getInstance('files');
$cachedItem = $InstanceCache->getItem('sample_cache_key');
$cachedData['cache_key'] = "cache_value";
$cachedItem->set($cachedData)->addTag('sample_tag'); // We don't specify expiry here
$InstanceCache->save($cachedItem);

My question is , up-to when this data will be available in cached storage?

You must be logged in to vote

My question is , up-to when this data will be available in cached storage?

Immediately.
Default TTL is 900 second if left untouched.

Replies: 1 comment · 3 replies

Comment options

My question is , up-to when this data will be available in cached storage?

Immediately.
Default TTL is 900 second if left untouched.

You must be logged in to vote
3 replies
@rahulradixweb
Comment options

Thanks for your response.

Means, If I get cache item (using getItem()) within 900 seconds, will it be extended (expiry time)?
And I don't get it within 900 seconds, it will be expired, is it so?
Any provision to override default TTL? without specifying to each write? (It seems , it can be done by setting global option defaultTtl when creating config, right?)

@rahulradixweb
Comment options

Do we have option to cache forever? untill we clear it explicitly?

@Geolim4
Comment options

Means, If I get cache item (using getItem()) within 900 seconds, will it be extended (expiry time)? And I don't get it within 900 seconds, it will be expired, is it so? Any provision to override default TTL? without specifying to each write? (It seems , it can be done by setting global option defaultTtl when creating config, right?)

It's 900 seconds that start at the time you requested the item via getItem().
See global options in Wiki:
https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options#global-options

Do we have option to cache forever? untill we clear it explicitly?

By definition a cache is not meant to be permanent, if you need permanent data use a database instead.

Answer selected by rahulradixweb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.