mirror of
https://github.com/YGGverse/cache-php.git
synced 2026-03-31 09:35:29 +00:00
remove current timestamp prefix from timeout definition
This commit is contained in:
parent
895a3dd6a2
commit
e6903cc640
2 changed files with 11 additions and 11 deletions
16
README.md
16
README.md
|
|
@ -10,11 +10,11 @@ Extends [PHP memcached](https://www.php.net/manual/en/book.memcached.php)
|
|||
```
|
||||
$memory = new Yggverse\Cache\Memory(
|
||||
|
||||
'localhost, // memcached server host, localhost by default
|
||||
11211, // memcached server port, 11211 by default
|
||||
'localhost, // memcached server host, localhost by default
|
||||
11211, // memcached server port, 11211 by default
|
||||
|
||||
'my_app', // application namespace
|
||||
3600 // cache time offset by default
|
||||
'my_app', // application namespace
|
||||
3600 + time() // cache time by default
|
||||
);
|
||||
```
|
||||
|
||||
|
|
@ -34,9 +34,9 @@ Return cached or cache new value of plain value callback
|
|||
|
||||
```
|
||||
$value = $memory->getByValueCallback(
|
||||
'key_name', // string, unique key name
|
||||
'value', // mixed, plain value
|
||||
3600, // optional, cache timeout offset for this value
|
||||
'key_name', // string, unique key name
|
||||
'value', // mixed, plain value
|
||||
3600 + time(), // optional, cache timeout for this value
|
||||
);
|
||||
```
|
||||
|
||||
|
|
@ -53,6 +53,6 @@ Return cached or cache new value of object method callback
|
|||
$method_attribute_2,
|
||||
...
|
||||
]
|
||||
3600, // optional, cache timeout offset for this value
|
||||
3600 + time(), // optional, cache timeout for this value
|
||||
);
|
||||
```
|
||||
|
|
@ -40,7 +40,7 @@ class Memory {
|
|||
]
|
||||
);
|
||||
|
||||
return $this->_memcached->set($key, $value, ($timeout ? $timeout : $this->_timeout) + time());
|
||||
return $this->_memcached->set($key, $value, ($timeout ? $timeout : $this->_timeout));
|
||||
}
|
||||
|
||||
public function delete(string $key) : bool
|
||||
|
|
@ -70,7 +70,7 @@ class Memory {
|
|||
}
|
||||
else
|
||||
{
|
||||
if (true === $this->_memcached->set($key, $value, ($timeout ? $timeout : $this->_timeout) + time()))
|
||||
if (true === $this->_memcached->set($key, $value, ($timeout ? $timeout : $this->_timeout)))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ class Memory {
|
|||
$arguments
|
||||
);
|
||||
|
||||
if (true === $this->_memcached->set($key, $value, ($timeout ? $timeout : $this->_timeout) + time()))
|
||||
if (true === $this->_memcached->set($key, $value, ($timeout ? $timeout : $this->_timeout)))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue