more refactoring on the framework.

This commit is contained in:
Taylor Otwell
2011-09-14 20:16:13 -05:00
parent c576c388b9
commit 26a66027f8
14 changed files with 143 additions and 193 deletions

View File

@@ -1,4 +1,4 @@
<?php namespace Laravel\Cache;
<?php namespace Laravel\Cache\Drivers;
use Laravel\Proxy;
@@ -50,7 +50,7 @@ class APC extends Driver {
*/
protected function retrieve($key)
{
return ( ! is_null($cache = $this->proxy->apc_fetch($this->key.$key))) ? $cache : null;
if ( ! is_null($cache = $this->proxy->apc_fetch($this->key.$key))) return $cache;
}
/**

View File

@@ -1,4 +1,4 @@
<?php namespace Laravel\Cache;
<?php namespace Laravel\Cache\Drivers;
use Closure;
@@ -18,14 +18,6 @@ abstract class Driver {
* A default value may also be specified, and will be returned in the requested
* item does not exist in the cache.
*
* <code>
* // Retrieve an item from the cache
* $name = Cache::get('name');
*
* // Retrieve an item from the cache and return a default value if it doesn't exist
* $name = Cache::get('name', 'Fred');
* </code>
*
* @param string $key
* @param mixed $default
* @param string $driver
@@ -49,11 +41,6 @@ abstract class Driver {
/**
* Write an item to the cache for a given number of minutes.
*
* <code>
* // Store an item in the cache for 5 minutes
* Cache::put('name', 'Fred', 5);
* </code>
*
* @param string $key
* @param mixed $value
* @param int $minutes
@@ -65,14 +52,6 @@ abstract class Driver {
* Get an item from the cache. If the item doesn't exist in the cache, store
* the default value in the cache and return it.
*
* <code>
* // Get an item from the cache and store the default value if it doesn't exist
* Cache::remember('name', 'Fred', 5);
*
* // Closures may also be used to defer retrieval of the default value
* Cache::remember('users', function() {return DB::table('users')->get();}, 5);
* </code>
*
* @param string $key
* @param mixed $default
* @param int $minutes

View File

@@ -1,4 +1,4 @@
<?php namespace Laravel\Cache;
<?php namespace Laravel\Cache\Drivers;
class File extends Driver {

View File

@@ -1,5 +1,6 @@
<?php namespace Laravel\Cache;
<?php namespace Laravel\Cache\Drivers;
use Memcache;
use Laravel\Config;
class Memcached extends Driver {
@@ -24,7 +25,7 @@ class Memcached extends Driver {
* @param Memcache $memcache
* @return void
*/
public function __construct(\Memcache $memcache, $key)
public function __construct(Memcache $memcache, $key)
{
$this->key = $key;
$this->memcache = $memcache;
@@ -49,7 +50,7 @@ class Memcached extends Driver {
*/
protected function retrieve($key)
{
return (($cache = $this->memcache->get($this->key.$key)) !== false) ? $cache : null;
if (($cache = $this->memcache->get($this->key.$key)) !== false) return $cache;
}
/**