system/library/cache.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
 * @package		OpenCart
 * @author		Daniel Kerr
 * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
 * @license		https://opensource.org/licenses/GPL-3.0
 * @link		https://www.opencart.com
 */

/**
 * @author:dc
 * @time 2022/4/12 15:28
 * Class Cache
 * @property Cache\File|Cache\Redis|Cache\Memcached $adaptor
 */
class Cache {
    private $adaptor;

    /**
     * Constructor
     *
     * @param	string	$adaptor	The type of storage for the cache.
     * @param	int		$expire		Optional parameters
     *
     */
    public function __construct($adaptor, $expire = 3600) {
        $class = 'Cache\\' . $adaptor;

        if (class_exists($class)) {
            $this->adaptor = new $class($expire);
        } else {
            throw new \Exception('Error: Could not load cache adaptor ' . $adaptor . ' cache!');
        }
    }

    public function setExpire($expire = 3600){
        $this->adaptor->setExpire($expire);
        return  $this->adaptor;
    }

    /**
     * Gets a cache by key name.
     *
     * @param	string $key	The cache key name
     *
     * @return	string
     */
    public function get($key) {
        return $this->adaptor->get($key);
    }

    /**
     *
     *
     * @param	string	$key	The cache key
     * @param	string	$value	The cache value
     *
     * @return	string
     */
    public function set($key, $value) {
后面还有 22 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。