src/Cache/DatabaseCacheUtil.php
public function cacheValue(string $key, $value)
    {
        if (!Config::get('activateDbCache')) {
            return false;
        }

        if ($this->getValue($key)) {
            throw new \Exception('Duplicate entry in tl_db_cache for key '.$key);
        }

        $now = time();

        $this->database->prepare('INSERT INTO tl_db_cache (tstamp, expiration, cacheKey, cacheValue) VALUES (?, ?, ?, ?)')->execute(
            $now,
            $now + $this->container->get('huh.utils.date')->getTimePeriodInSeconds(
                StringUtil::deserialize(Config::get('dbCacheMaxTime'), true)
            ),
            $key,
            $value
        );

        return true;
    }
public function cacheValue(string $key, $value)
    {
        if (!Config::get('activateDbCache')) {
            return false;
        }

        if ($this->getValue($key)) {
            throw new \Exception('Duplicate entry in tl_db_cache for key '.$key);
        }

        $now = time();

        $this->database->prepare('INSERT INTO tl_db_cache (tstamp, expiration, cacheKey, cacheValue) VALUES (?, ?, ?, ?)')->execute(
            $now,
            $now + $this->container->get('huh.utils.date')->getTimePeriodInSeconds(
                StringUtil::deserialize(Config::get('dbCacheMaxTime'), true)
            ),
            $key,
            $value
        );

        return true;
    }
public function cacheValue ( string $ key , $ value ) { if ( ! Config :: get ( 'activateDbCache' ) ) { return false ; } if ( $ this -> getValue ( $ key ) ) { throw new \ Exception ( 'Duplicate entry in tl_db_cache for key ' . $ key ) ; } $ now = time ( ) ; $ this -> database -> prepare ( 'INSERT INTO tl_db_cache (tstamp, expiration, cacheKey, cacheValue) VALUES (?, ?, ?, ?)' ) -> execute ( $ now , $ now + $ this -> container -> get ( 'huh.utils.date' ) -> getTimePeriodInSeconds ( StringUtil :: deserialize ( Config :: get ( 'dbCacheMaxTime' ) , true ) ) , $ key , $ value ) ; return true ; }
Store a given value to cache.

@param string $key
@param        $value

@throws \Exception

@return bool
Store a given value to cache .