My stack : symfony 6.4 and php8.1
I encountered a problem when i want to use cache in symfony with the save method like below.
$item = $cache->getItem('my_cache_key');
if (!$item->isHit()) {
$item->set('new_value1');
$item->expiresAfter(3600);
$cache->save($item);
}
The result is :
SymfonyComponentCacheCacheItem {#1105 ▼
#key: "my_cache_key"
#value: "new_value1"
#isHit: false
#expiry: 1718978664.0953
#metadata: []
#newMetadata: []
#innerItem: null
#poolHash: null
#isTaggable: false
}
Then, when i want to retrieve information from cache the field expiry is empty
$item = $cache->getItem('my_cache_key');
echo "<br/>object";
dump($item);
The result is :
SymfonyComponentCacheCacheItem {#1115 ▼
#key: "my_cache_key"
#value: "new_value1"
#isHit: true
#expiry: null
#metadata: []
#newMetadata: []
#innerItem: null
#poolHash: null
#isTaggable: false
}
Any ideas ?
I expected yo find the date expiry after having hit the cache