vendredi 6 septembre 2019

Reset Cache TTL From Last Access

I was wondering if there is any way to update cache TTL from the last time it has accessed?

currently, I have a method to login to adobe connect with API call and API session is valid for 4 days from the last call. but my cache driver only keeps session in the cache for 4 days from the moment that is added. but I want to keep it for 4 days since the last time it has accessed!

is there any way to update Cache TTL? I'm sure forgetting and reinserting key is not best practice.


    /**
     * Login Client Based information that introduced in environment/config file
     *
     * @param Client $client
     *
     * @return void
     */
    private function loginClient(Client $client)
    {
        $config = $this->app["config"]->get("adobeConnect");

        $session = Cache::store($config->get["session-cache"]["driver"])->remember(
            $config['session-cache']['key'],
            $config['session-cache']['expire'],
            function () use ($config, $client) {
                $client->login($config["user-name"], $config["password"]);
                return $client->getSession();
            });

        $client->setSession($session);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire