Implemented all changes requested by the TechFuze team.
This commit is contained in:
parent
051c64fdaa
commit
66c9bb45c5
@ -408,6 +408,16 @@ class Layout
|
|||||||
throw new LayoutException('Could not set engine. Engine does not exist', 1);
|
throw new LayoutException('Could not set engine. Engine does not exist', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the engine so a new one can be used the next time
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function resetEngine()
|
||||||
|
{
|
||||||
|
$this->current_engine = null;
|
||||||
|
Logger::log('Reset the active engine for Layout');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a loaded template engine.
|
* Get a loaded template engine.
|
||||||
*
|
*
|
||||||
|
@ -348,10 +348,10 @@ class Libraries
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If required to do so, return the existing instance or load a new one
|
// If required to do so, return the existing instance or load a new one
|
||||||
if ($newInstance)
|
if (!$newInstance)
|
||||||
{
|
{
|
||||||
$this->factory->logger->log("Library '".$className."' already loaded. Returning existing instance");
|
$this->factory->logger->log("Library '".$className."' already loaded. Returning existing instance");
|
||||||
return $this->libraries[$prefix.$class];
|
return $this->libraries[$className];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->factory->logger->log("Library '".$className."' already loaded. Returning new instance");
|
$this->factory->logger->log("Library '".$className."' already loaded. Returning new instance");
|
||||||
|
@ -154,7 +154,7 @@ class URI {
|
|||||||
: $this->_parse_request_uri();
|
: $this->_parse_request_uri();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_set_uri_string($uri, FALSE);
|
$this->_set_uri_string($uri, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* The FuzeWorks MVC PHP FrameWork
|
* The FuzeWorks MVC PHP FrameWork
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 TechFuze
|
* Copyright (C) 2018 TechFuze
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,14 +20,14 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* @author TechFuze
|
* @author TechFuze
|
||||||
* @copyright Copyright (c) 2013 - 2016, Techfuze. (http://techfuze.net)
|
* @copyright Copyright (c) 2013 - 2018, Techfuze. (http://techfuze.net)
|
||||||
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
|
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
|
||||||
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
|
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
|
||||||
*
|
*
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 0.0.1
|
* @since Version 0.0.1
|
||||||
*
|
*
|
||||||
* @version Version 1.0.0
|
* @version Version 1.1.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Library;
|
namespace FuzeWorks\Library;
|
||||||
@ -53,6 +53,7 @@ class FW_Cache extends FW_Driver_Library {
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $valid_drivers = array(
|
protected $valid_drivers = array(
|
||||||
|
'array',
|
||||||
'apc',
|
'apc',
|
||||||
'dummy',
|
'dummy',
|
||||||
'file',
|
'file',
|
||||||
@ -99,6 +100,8 @@ class FW_Cache extends FW_Driver_Library {
|
|||||||
*/
|
*/
|
||||||
public function __construct($config = array())
|
public function __construct($config = array())
|
||||||
{
|
{
|
||||||
|
require_once('Cache_Interface.php');
|
||||||
|
|
||||||
isset($config['adapter']) && $this->_adapter = $config['adapter'];
|
isset($config['adapter']) && $this->_adapter = $config['adapter'];
|
||||||
isset($config['backup']) && $this->_backup_driver = $config['backup'];
|
isset($config['backup']) && $this->_backup_driver = $config['backup'];
|
||||||
isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix'];
|
isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix'];
|
||||||
@ -148,9 +151,9 @@ class FW_Cache extends FW_Driver_Library {
|
|||||||
* @param bool $raw Whether to store the raw value
|
* @param bool $raw Whether to store the raw value
|
||||||
* @return bool TRUE on success, FALSE on failure
|
* @return bool TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
return $this->{$this->_adapter}->save($this->key_prefix.$id, $data, $ttl, $raw);
|
return $this->{$this->_adapter}->set($this->key_prefix.$id, $data, $ttl, $raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
@ -161,9 +164,9 @@ class FW_Cache extends FW_Driver_Library {
|
|||||||
* @param string $id Cache ID
|
* @param string $id Cache ID
|
||||||
* @return bool TRUE on success, FALSE on failure
|
* @return bool TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function remove($id)
|
||||||
{
|
{
|
||||||
return $this->{$this->_adapter}->delete($this->key_prefix.$id);
|
return $this->{$this->_adapter}->remove($this->key_prefix.$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
109
src/Libraries/Cache/Cache_Interface.php
Normal file
109
src/Libraries/Cache/Cache_Interface.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FuzeWorks.
|
||||||
|
*
|
||||||
|
* The FuzeWorks MVC PHP FrameWork
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 TechFuze
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @author TechFuze
|
||||||
|
* @copyright Copyright (c) 2013 - 2018, Techfuze. (http://techfuze.net)
|
||||||
|
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
|
||||||
|
*
|
||||||
|
* @link http://techfuze.net/fuzeworks
|
||||||
|
* @since Version 1.1.5
|
||||||
|
*
|
||||||
|
* @version Version 1.1.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FuzeWorks\Library;
|
||||||
|
|
||||||
|
interface CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve an item from the cache, resolves with its value on
|
||||||
|
* success or null when no item can be found.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get($key);
|
||||||
|
/**
|
||||||
|
* Store an item in the cache.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set($key, $value, $ttl = 60, $raw = FALSE);
|
||||||
|
/**
|
||||||
|
* Remove an item from the cache.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function remove($key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment a raw value
|
||||||
|
*
|
||||||
|
* @param string $id Cache ID
|
||||||
|
* @param int $offset Step/value to add
|
||||||
|
* @return mixed New value on success or FALSE on failure
|
||||||
|
*/
|
||||||
|
public function increment($id, $offset = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrement a raw value
|
||||||
|
*
|
||||||
|
* @param string $id Cache ID
|
||||||
|
* @param int $offset Step/value to reduce by
|
||||||
|
* @return mixed New value on success or FALSE on failure
|
||||||
|
*/
|
||||||
|
public function decrement($id, $offset = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean the cache
|
||||||
|
*
|
||||||
|
* @return bool TRUE on success, FALSE on failure
|
||||||
|
*/
|
||||||
|
public function clean();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Info
|
||||||
|
*
|
||||||
|
* @param string $type = 'user' user/filehits
|
||||||
|
* @return mixed array containing cache info on success OR FALSE on failure
|
||||||
|
*/
|
||||||
|
public function cache_info($type = 'user');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Cache Metadata
|
||||||
|
*
|
||||||
|
* @param string $id key to get cache metadata on
|
||||||
|
* @return mixed cache item metadata
|
||||||
|
*/
|
||||||
|
public function get_metadata($id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the requested driver supported in this environment?
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function is_supported();
|
||||||
|
}
|
@ -45,7 +45,7 @@ use FuzeWorks\Logger;
|
|||||||
* @link
|
* @link
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
*/
|
*/
|
||||||
class FW_Cache_apc extends FW_Driver {
|
class FW_Cache_apc extends FW_Driver implements CacheInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
@ -100,7 +100,7 @@ class FW_Cache_apc extends FW_Driver {
|
|||||||
* @param bool $raw Whether to store the raw value
|
* @param bool $raw Whether to store the raw value
|
||||||
* @return bool TRUE on success, FALSE on failure
|
* @return bool TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
$ttl = (int) $ttl;
|
$ttl = (int) $ttl;
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ class FW_Cache_apc extends FW_Driver {
|
|||||||
* @param mixed unique identifier of the item in the cache
|
* @param mixed unique identifier of the item in the cache
|
||||||
* @return bool true on success/false on failure
|
* @return bool true on success/false on failure
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function remove($id)
|
||||||
{
|
{
|
||||||
return apc_delete($id);
|
return apc_delete($id);
|
||||||
}
|
}
|
||||||
|
182
src/Libraries/Cache/drivers/Cache_array.php
Normal file
182
src/Libraries/Cache/drivers/Cache_array.php
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FuzeWorks.
|
||||||
|
*
|
||||||
|
* The FuzeWorks MVC PHP FrameWork
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 TechFuze
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @author TechFuze
|
||||||
|
* @copyright Copyright (c) 2013 - 2018, Techfuze. (http://techfuze.net)
|
||||||
|
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
|
||||||
|
*
|
||||||
|
* @link http://techfuze.net/fuzeworks
|
||||||
|
* @since Version 1.1.5
|
||||||
|
*
|
||||||
|
* @version Version 1.1.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FuzeWorks\Library;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FuzeWorks Array Caching Class
|
||||||
|
*
|
||||||
|
* @author TechFuze
|
||||||
|
*/
|
||||||
|
class FW_Cache_array extends FW_Driver implements CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
private $data = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Get
|
||||||
|
*
|
||||||
|
* Since this is the dummy class, it's always going to return FALSE.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return bool FALSE
|
||||||
|
*/
|
||||||
|
public function get($id)
|
||||||
|
{
|
||||||
|
if (isset($this->data[$id]))
|
||||||
|
{
|
||||||
|
$expire = $this->data[$id]['expire'];
|
||||||
|
if (date('U') > $expire )
|
||||||
|
{
|
||||||
|
unset($this->data[$id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->data[$id]['data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Save
|
||||||
|
*
|
||||||
|
* @param string Unique Key
|
||||||
|
* @param mixed Data to store
|
||||||
|
* @param int Length of time (in seconds) to cache the data
|
||||||
|
* @param bool Whether to store the raw value
|
||||||
|
* @return bool TRUE, Simulating success
|
||||||
|
*/
|
||||||
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
|
{
|
||||||
|
$this->data[$id] = array('data' => $data, 'expire' => date('U') + $ttl);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete from Cache
|
||||||
|
*
|
||||||
|
* @param mixed unique identifier of the item in the cache
|
||||||
|
* @return bool TRUE, simulating success
|
||||||
|
*/
|
||||||
|
public function remove($id)
|
||||||
|
{
|
||||||
|
if (isset($this->data[$id]))
|
||||||
|
unset($this->data[$id]);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment a raw value
|
||||||
|
*
|
||||||
|
* @param string $id Cache ID
|
||||||
|
* @param int $offset Step/value to add
|
||||||
|
* @return mixed New value on success or FALSE on failure
|
||||||
|
*/
|
||||||
|
public function increment($id, $offset = 1)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrement a raw value
|
||||||
|
*
|
||||||
|
* @param string $id Cache ID
|
||||||
|
* @param int $offset Step/value to reduce by
|
||||||
|
* @return mixed New value on success or FALSE on failure
|
||||||
|
*/
|
||||||
|
public function decrement($id, $offset = 1)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean the cache
|
||||||
|
*
|
||||||
|
* @return bool TRUE, simulating success
|
||||||
|
*/
|
||||||
|
public function clean()
|
||||||
|
{
|
||||||
|
$this->data = array();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Info
|
||||||
|
*
|
||||||
|
* @param string user/filehits
|
||||||
|
* @return bool FALSE
|
||||||
|
*/
|
||||||
|
public function cache_info($type = NULL)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Cache Metadata
|
||||||
|
*
|
||||||
|
* @param mixed key to get cache metadata on
|
||||||
|
* @return bool FALSE
|
||||||
|
*/
|
||||||
|
public function get_metadata($id)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this caching driver supported on the system?
|
||||||
|
* Of course this one is.
|
||||||
|
*
|
||||||
|
* @return bool TRUE
|
||||||
|
*/
|
||||||
|
public function is_supported()
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -44,7 +44,7 @@ namespace FuzeWorks\Library;
|
|||||||
* @link
|
* @link
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
*/
|
*/
|
||||||
class FW_Cache_dummy extends FW_Driver {
|
class FW_Cache_dummy extends FW_Driver implements CacheInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get
|
* Get
|
||||||
@ -70,7 +70,7 @@ class FW_Cache_dummy extends FW_Driver {
|
|||||||
* @param bool Whether to store the raw value
|
* @param bool Whether to store the raw value
|
||||||
* @return bool TRUE, Simulating success
|
* @return bool TRUE, Simulating success
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ class FW_Cache_dummy extends FW_Driver {
|
|||||||
* @param mixed unique identifier of the item in the cache
|
* @param mixed unique identifier of the item in the cache
|
||||||
* @return bool TRUE, simulating success
|
* @return bool TRUE, simulating success
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function remove($id)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 0.0.1
|
* @since Version 0.0.1
|
||||||
*
|
*
|
||||||
* @version Version 1.0.0
|
* @version Version 1.1.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Library;
|
namespace FuzeWorks\Library;
|
||||||
@ -46,7 +46,7 @@ use FuzeWorks\Core;
|
|||||||
* @link
|
* @link
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
*/
|
*/
|
||||||
class FW_Cache_file extends FW_Driver {
|
class FW_Cache_file extends FW_Driver implements CacheInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory in which to save cache files
|
* Directory in which to save cache files
|
||||||
@ -55,13 +55,6 @@ class FW_Cache_file extends FW_Driver {
|
|||||||
*/
|
*/
|
||||||
protected $_cache_path;
|
protected $_cache_path;
|
||||||
|
|
||||||
/**
|
|
||||||
* The FuzeWorks factory class
|
|
||||||
*
|
|
||||||
* @var Fuzeworks\Factory;
|
|
||||||
*/
|
|
||||||
private $factory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize file-based cache
|
* Initialize file-based cache
|
||||||
*
|
*
|
||||||
@ -70,10 +63,10 @@ class FW_Cache_file extends FW_Driver {
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Load the factory
|
// Load the factory
|
||||||
$this->factory = Factory::getInstance();
|
$factory = Factory::getInstance();
|
||||||
|
|
||||||
// Load the required helpers
|
// Load the required helpers
|
||||||
$this->factory->helpers->load('file');
|
$factory->helpers->load('file');
|
||||||
$this->_cache_path = Core::$tempDir . DS . 'CacheLibrary' . DS;
|
$this->_cache_path = Core::$tempDir . DS . 'CacheLibrary' . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +95,7 @@ class FW_Cache_file extends FW_Driver {
|
|||||||
* @param bool $raw Whether to store the raw value (unused)
|
* @param bool $raw Whether to store the raw value (unused)
|
||||||
* @return bool TRUE on success, FALSE on failure
|
* @return bool TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
$contents = array(
|
$contents = array(
|
||||||
'time' => time(),
|
'time' => time(),
|
||||||
@ -127,7 +120,7 @@ class FW_Cache_file extends FW_Driver {
|
|||||||
* @param mixed unique identifier of item in cache
|
* @param mixed unique identifier of item in cache
|
||||||
* @return bool true on success/false on failure
|
* @return bool true on success/false on failure
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function remove($id)
|
||||||
{
|
{
|
||||||
return file_exists($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE;
|
return file_exists($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ use Memcache;
|
|||||||
* @link
|
* @link
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
*/
|
*/
|
||||||
class FW_Cache_memcached extends FW_Driver {
|
class FW_Cache_memcached extends FW_Driver implements CacheInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the memcached object
|
* Holds the memcached object
|
||||||
@ -153,7 +153,7 @@ class FW_Cache_memcached extends FW_Driver {
|
|||||||
* @param bool $raw Whether to store the raw value
|
* @param bool $raw Whether to store the raw value
|
||||||
* @return bool TRUE on success, FALSE on failure
|
* @return bool TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
if ($raw !== TRUE)
|
if ($raw !== TRUE)
|
||||||
{
|
{
|
||||||
@ -180,7 +180,7 @@ class FW_Cache_memcached extends FW_Driver {
|
|||||||
* @param mixed $id key to be deleted.
|
* @param mixed $id key to be deleted.
|
||||||
* @return bool true on success, false on failure
|
* @return bool true on success, false on failure
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function remove($id)
|
||||||
{
|
{
|
||||||
return $this->_memcached->delete($id);
|
return $this->_memcached->delete($id);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ use RedisException;
|
|||||||
* @link
|
* @link
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
*/
|
*/
|
||||||
class FW_Cache_redis extends FW_Driver
|
class FW_Cache_redis extends FW_Driver implements CacheInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Default config
|
* Default config
|
||||||
@ -165,7 +165,7 @@ class FW_Cache_redis extends FW_Driver
|
|||||||
* @param bool $raw Whether to store the raw value (unused)
|
* @param bool $raw Whether to store the raw value (unused)
|
||||||
* @return bool TRUE on success, FALSE on failure
|
* @return bool TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
if (is_array($data) OR is_object($data))
|
if (is_array($data) OR is_object($data))
|
||||||
{
|
{
|
||||||
@ -194,7 +194,7 @@ class FW_Cache_redis extends FW_Driver
|
|||||||
* @param string $key Cache key
|
* @param string $key Cache key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function delete($key)
|
public function remove($key)
|
||||||
{
|
{
|
||||||
if ($this->_redis->delete($key) !== 1)
|
if ($this->_redis->delete($key) !== 1)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ use FuzeWorks\Logger;
|
|||||||
* @link
|
* @link
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
*/
|
*/
|
||||||
class FW_Cache_wincache extends FW_Driver {
|
class FW_Cache_wincache extends FW_Driver implements CacheInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
@ -97,7 +97,7 @@ class FW_Cache_wincache extends FW_Driver {
|
|||||||
* @param bool $raw Whether to store the raw value (unused)
|
* @param bool $raw Whether to store the raw value (unused)
|
||||||
* @return bool true on success/false on failure
|
* @return bool true on success/false on failure
|
||||||
*/
|
*/
|
||||||
public function save($id, $data, $ttl = 60, $raw = FALSE)
|
public function set($id, $data, $ttl = 60, $raw = FALSE)
|
||||||
{
|
{
|
||||||
return wincache_ucache_set($id, $data, $ttl);
|
return wincache_ucache_set($id, $data, $ttl);
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ class FW_Cache_wincache extends FW_Driver {
|
|||||||
* @param mixed unique identifier of the item in the cache
|
* @param mixed unique identifier of the item in the cache
|
||||||
* @return bool true on success/false on failure
|
* @return bool true on success/false on failure
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function remove($id)
|
||||||
{
|
{
|
||||||
return wincache_ucache_delete($id);
|
return wincache_ucache_delete($id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user