Skip to content
Advertisement

Laravel/Lumen MemcachedStore calculateExpiration method (memcached set with unixtimestamp)

In core I have aforementioned class (MemcachedStore), which has put method as:

        $a = $this->memcached->set(
            $this->prefix.$key, $value, $this->calculateExpiration($seconds)
        );

Memcached’s set method accepts three parameters: key, value, seconds_to_store_in_cache

My questions is: Why would I need to calculate expiration Carbon::now() + seconds passed to this function?

Result: This is not working. Memcached returns 0 “success”. But entry is not written. (With “get” method I cant find it)

If I just pass seconds (override in core class), everything works as expected

UPD! Nothing to do with laravel or lumen

Advertisement

Answer

Actually Memchached’s set method can accept third parameter as unixtimestamp, but in this case memcached time (os time) should be correct. Memcached time can be checked by Memchached’s getStats

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement