Commit 1ff5f845 authored by Taylor Otwell's avatar Taylor Otwell

added apc driver notes in cache configuration file.

parent ab3be568
...@@ -12,12 +12,24 @@ return array( ...@@ -12,12 +12,24 @@ return array(
| Caching can be used to increase the performance of your application | Caching can be used to increase the performance of your application
| by storing commonly accessed data in memory or in a file. | by storing commonly accessed data in memory or in a file.
| |
| Supported Drivers: 'file', 'memcached'. | Supported Drivers: 'file', 'memcached', 'apc'.
| |
*/ */
'driver' => 'file', '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 | Memcached Servers
...@@ -35,18 +47,6 @@ return array( ...@@ -35,18 +47,6 @@ return array(
'servers' => array( 'servers' => array(
array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 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',
); );
\ No newline at end of file
...@@ -29,22 +29,13 @@ class APC implements \System\Cache\Driver { ...@@ -29,22 +29,13 @@ class APC implements \System\Cache\Driver {
*/ */
public function get($key, $default = null) public function get($key, $default = null)
{ {
// --------------------------------------------------
// If the item has already been loaded, return it.
// --------------------------------------------------
if (array_key_exists($key, $this->items)) if (array_key_exists($key, $this->items))
{ {
return $this->items[$key]; return $this->items[$key];
} }
// --------------------------------------------------
// Attempt to the get the item from cache.
// --------------------------------------------------
$cache = apc_fetch(\System\Config::get('cache.key').$key); $cache = apc_fetch(\System\Config::get('cache.key').$key);
// --------------------------------------------------
// Verify that the item was retrieved.
// --------------------------------------------------
if ($cache === false) if ($cache === false)
{ {
return $default; return $default;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment