Skip to content

Commit

Permalink
Introduce CacheControllerInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Oct 18, 2018
1 parent e6a1124 commit 89940aa
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
3 changes: 1 addition & 2 deletions libraries/src/Cache/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* Public cache handler
*
* @since 1.7.0
* @note As of 4.0 this class will be abstract
*/
class CacheController
class CacheController implements CacheControllerInterface
{
/**
* Cache object
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Cache/CacheControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class CacheControllerFactory implements CacheControllerFactoryInterface
* @param string $type The cache object type to instantiate
* @param array $options Array of options
*
* @return CacheController
* @return CacheControllerInterface
*
* @since __DEPLOY_VERSION__
* @throws \RuntimeException
*/
public function createCacheController($type = 'output', $options = array()): CacheController
public function createCacheController($type = 'output', $options = array()): CacheControllerInterface
{
$type = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $type));

Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Cache/CacheControllerFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ interface CacheControllerFactoryInterface
* @param string $type The cache object type to instantiate
* @param array $options Array of options
*
* @return CacheController
* @return CacheControllerInterface
*
* @since __DEPLOY_VERSION__
* @throws \RuntimeException
*/
public function createCacheController($type = 'output', $options = array()): CacheController;
public function createCacheController($type = 'output', $options = array()): CacheControllerInterface;
}
45 changes: 45 additions & 0 deletions libraries/src/Cache/CacheControllerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Cache;

defined('_JEXEC') or die;

/**
* The cache controller interface.
*
* @since __DEPLOY_VERSION__
*/
interface CacheControllerInterface
{
/**
* Get stored cached data by ID and group.
*
* @param string $id The cache data ID
* @param string $group The cache data group
*
* @return mixed Boolean false on no result, cached object otherwise
*
* @since __DEPLOY_VERSION__
*/
public function get($id, $group = null);

/**
* Store data to cache by ID and group.
*
* @param mixed $data The data to store
* @param string $id The cache data ID
* @param string $group The cache data group
* @param boolean $wrkarounds True to use wrkarounds
*
* @return boolean True if cache stored
*
* @since __DEPLOY_VERSION__
*/
public function store($data, $id, $group = null, $wrkarounds = true);
}

0 comments on commit 89940aa

Please sign in to comment.