I use
$cache = new FilesystemAdapter();
var_dump($cache->getItem('test_cache_key'));
exit;
Now this value is not recorded anywhere. I've tried every possible command:
php bin/console cache:clear
php bin/console cache:pool:prune
php bin/console cache:pool:clear cache.app
And others like that in a variety of variations.
Also I was clearing /tmp.
And deleted the /var/cache directory in the Symfony project.
But all is useless. When $cache->getItem('test_cache_key') is called, the cache stays in place.
object(Symfony\Component\Cache\CacheItem)#2566 (9) {
["key":protected]=>
string(14) "test_cache_key"
["value":protected]=>
string(16) "test_cache_value"
["isHit":protected]=>
bool(true)
["expiry":protected]=>
NULL
["metadata":protected]=>
array(0) {
}
["newMetadata":protected]=>
array(0) {
}
["innerItem":protected]=>
NULL
["poolHash":protected]=>
NULL
["isTaggable":protected]=>
bool(false)
}
I have no idea what to do. Help me please.
UPD.
Current configuration for "framework.cache"
===========================================
prefix_seed: _%kernel.project_dir%.%kernel.container_class%
app: cache.adapter.filesystem
system: cache.adapter.system
directory: '%kernel.cache_dir%/pools'
default_redis_provider: 'redis://localhost'
default_memcached_provider: 'memcached://localhost'
default_pdo_provider: database_connection
pools: { }
My Answer:
It seems like the cache is not being cleared properly due to the configuration settings.
One thing you can try is to explicitly specify the cache pool you want to clear in the cache:clear command. For example, you can try running:
php bin/console cache:clear cache.app
If that doesn't work, you can try manually deleting the cache files in the cache directory. You can find the cache directory path in your Symfony project by checking the value of '%kernel.cache_dir%' in your configuration files.
If you are still facing issues, you may want to check if there are any custom cache configurations or services that are interfering with the cache clearing process.
Additionally, you can try clearing the cache using the Symfony Cache component directly, by calling the clear() method on the cache pool:
$cache = new FilesystemAdapter();
$cache->clear();
This should clear all the cache items in the specified cache pool.
If none of these solutions work, you may want to consider reaching out to the Symfony community or support for further assistance.
Rate this post
3 of 5 based on 3824 votesComments