Added new Sectionable interface to allow cache drivers to expose "namespace" type functionality.

This commit is contained in:
Taylor Otwell
2012-04-26 20:48:58 -05:00
parent 9057c60a5f
commit a892b85e8b
2 changed files with 227 additions and 2 deletions

74
laravel/cache/drivers/sectionable.php vendored Normal file
View File

@@ -0,0 +1,74 @@
<?php namespace Laravel\Cache\Drivers;
interface Sectionable {
/**
* Retrieve a sectioned item from the cache driver.
*
* @param string $section
* @param string $key
* @param mixed $default
* @return mixed
*/
public function get_from_section($section, $key, $default = null);
/**
* Write a sectioned item to the cache.
*
* @param string $section
* @param string $key
* @param mixed $value
* @param int $minutes
* @return void
*/
public function put_in_section($section, $key, $value, $minutes);
/**
* Write a sectioned item to the cache that lasts forever.
*
* @param string $section
* @param string $key
* @param mixed $value
* @return void
*/
public function forever_in_section($section, $key, $value);
/**
* Get a sectioned item from the cache, or cache and return the default value.
*
* @param string $section
* @param string $key
* @param mixed $default
* @param int $minutes
* @return mixed
*/
public function remember_in_section($section, $key, $default, $minutes, $function = 'put');
/**
* Get a sectioned item from the cache, or cache the default value forever.
*
* @param string $section
* @param string $key
* @param mixed $default
* @return mixed
*/
public function sear_in_section($section, $key, $default);
/**
* Delete a sectioned item from the cache.
*
* @param string $section
* @param string $key
* @return void
*/
public function forget_in_section($section, $key);
/**
* Delete an entire section from the cache.
*
* @param string $section
* @return int|bool
*/
public function forget_section($section);
}