I'm working with APCu in PHP.
I'm setting a key and its value, setting the expiration, but after the expiration it's not deleting itself. I guess this is because checking if something is expired and deleting it when its expired are two different things and I get that.
I see in var_dump there is another value called "deletion_time". How do I set the deletion so that my keys delete after 10 seconds of being stored?
<?php
// First I store the key with the expiration time of 10 seconds
$ip = 1.0.0.1;
$expires = 10;
$value = array("requests" => 1);
apcu_store($ip, $value, $expires);
// But then on the next request when I check the key I get the following, and the key isn't deleted
sleep(11);
var_dump(apcu_key_info($ip));
//{ ["hits"]=> int(1) ["access_time"]=> int(5629781) ["mtime"]=> int(5629765) ["creation_time"]=> int(5629765) ["deletion_time"]=> int(0) ["ttl"]=> int(10) ["refs"]=> int(0) }
?>
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.