Skip to content

Memcached with wrong expiration time #167

@therealsamsquanch

Description

@therealsamsquanch

To set the expiration time, we should only pass the duration of the cache in seconds. The function driver_set of the driver is using an absolute time, adding the current unix time + expiration time, so my keys are never expiring. Removing time() from the expiration makes it work as expected.

File: phpfastcache/3.0.0/drivers/memcached.php
Code with the fix:

    function driver_set($keyword, $value = "", $time = 300, $option = array() ) {
        $this->connectServer();
        if(isset($option['isExisting']) && $option['isExisting'] == true) {
            return $this->instant->add($keyword, $value, $time );
        } else {
            return $this->instant->set($keyword, $value, $time );

        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions