added apc driver notes in cache configuration file.

This commit is contained in:
Taylor Otwell
2011-06-18 19:49:29 -05:00
parent ab3be568ea
commit 1ff5f84545
2 changed files with 14 additions and 23 deletions

View File

@@ -12,12 +12,24 @@ return array(
| Caching can be used to increase the performance of your application
| by storing commonly accessed data in memory or in a file.
|
| Supported Drivers: 'file', 'memcached'.
| Supported Drivers: 'file', 'memcached', 'apc'.
|
*/
'driver' => 'file',
/*
|--------------------------------------------------------------------------
| Cache Key
|--------------------------------------------------------------------------
|
| This key will be prepended to items stored using Memcached and APC to
| prevent collisions with other applications on the server.
|
*/
'key' => 'laravel',
/*
|--------------------------------------------------------------------------
| Memcached Servers
@@ -37,16 +49,4 @@ return array(
array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
),
/*
|--------------------------------------------------------------------------
| Memcached Key
|--------------------------------------------------------------------------
|
| This key will be prepended to items stored using Memcached to avoid
| collisions with other applications on the server.
|
*/
'key' => 'laravel',
);

View File

@@ -29,22 +29,13 @@ class APC implements \System\Cache\Driver {
*/
public function get($key, $default = null)
{
// --------------------------------------------------
// If the item has already been loaded, return it.
// --------------------------------------------------
if (array_key_exists($key, $this->items))
{
return $this->items[$key];
}
// --------------------------------------------------
// Attempt to the get the item from cache.
// --------------------------------------------------
$cache = apc_fetch(\System\Config::get('cache.key').$key);
// --------------------------------------------------
// Verify that the item was retrieved.
// --------------------------------------------------
if ($cache === false)
{
return $default;