Skip to content

Commit

Permalink
Merge branch '2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone committed Jun 15, 2013
2 parents 9eb0a9c + 74e35eb commit 6a446cc
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 95 deletions.
18 changes: 9 additions & 9 deletions src/Orchestra/Memory/Drivers/Cache.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php namespace Orchestra\Memory\Drivers;

class Cache extends Driver {

/**
* Storage name
* Storage name.
*
* @access protected
* @var string
* @var string
*/
protected $storage = 'cache';

/**
* Load the data from database using Cache
* Load the data from database using Cache.
*
* @access public
* @return void
* @access public
* @return void
*/
public function initiate()
{
Expand All @@ -22,10 +22,10 @@ public function initiate()
}

/**
* Add a finish event using Cache
* Add a finish event using Cache.
*
* @access public
* @return void
* @access public
* @return void
*/
public function finish()
{
Expand Down
78 changes: 35 additions & 43 deletions src/Orchestra/Memory/Drivers/Driver.php
Original file line number Diff line number Diff line change
@@ -1,61 +1,54 @@
<?php namespace Orchestra\Memory\Drivers;

use Illuminate\Support\Facades\Config;

abstract class Driver {

/**
* Application instance.
*
* @var Illuminate\Foundation\Application
* @var \Illuminate\Foundation\Application
*/
protected $app = null;

/**
* Memory name
* Memory name.
*
* @access protected
* @var string
* @var string
*/
protected $name = null;

/**
* Memory configuration
* Memory configuration.
*
* @access protected
* @var array
* @var array
*/
protected $config = array();

/**
* Collection of key-value pair of either configuration or data
* Collection of key-value pair of either configuration or data.
*
* @access protected
* @var array
* @var array
*/
protected $data = array();

/**
* Cached key value map with md5 checksum
*
* @access protected
* @var array
* Cached key value map with md5 checksum.
*
* @var array
*/
protected $keyMap = array();

/**
* Storage name
* Storage name.
*
* @access protected
* @var string
* @var string
*/
protected $storage;

/**
* Construct an instance.
*
* @access public
* @param Illuminate\Foundation\Application $app
* @access public
* @param \Illuminate\Foundation\Application $app
* @param string $name
* @return void
*/
Expand All @@ -72,12 +65,12 @@ public function __construct($app, $name = 'default')
}

/**
* Get value of a key
* Get value of a key.
*
* @access public
* @param string $key A string of key to search.
* @param mixed $default Default value if key doesn't exist.
* @return mixed
* @access public
* @param string $key A string of key to search.
* @param mixed $default Default value if key doesn't exist.
* @return mixed
*/
public function get($key = null, $default = null)
{
Expand All @@ -89,12 +82,12 @@ public function get($key = null, $default = null)
}

/**
* Set a value from a key
* Set a value from a key.
*
* @access public
* @param string $key A string of key to add the value.
* @param mixed $value The value.
* @return mixed
* @access public
* @param string $key A string of key to add the value.
* @param mixed $value The value.
* @return mixed
*/
public function put($key, $value = '')
{
Expand All @@ -105,11 +98,11 @@ public function put($key, $value = '')
}

/**
* Delete value of a key
* Delete value of a key.
*
* @access public
* @param string $key A string of key to delete.
* @return bool
* @access public
* @param string $key A string of key to delete.
* @return boolean
*/
public function forget($key = null)
{
Expand Down Expand Up @@ -145,7 +138,6 @@ protected function getKeyId($name)
/**
* Get ID from key.
*
*
* @access protected
* @param string $name
* @return boolean
Expand All @@ -161,28 +153,28 @@ protected function isNewKey($name)
* @access protected
* @param string $name
* @param string $check
* @return void
* @return boolean
*/
protected function check($name, $check = '')
{
return (array_get($this->keyMap, "{$name}.checksum") === md5($check));
}

/**
* Initialize method
* Initialize method.
*
* @abstract
* @access public
* @return void
* @access public
* @return void
*/
public abstract function initiate();

/**
* Shutdown method
* Shutdown method.
*
* @abstract
* @access public
* @return void
* @access public
* @return void
*/
public abstract function finish();
}
17 changes: 8 additions & 9 deletions src/Orchestra/Memory/Drivers/Eloquent.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
class Eloquent extends Driver {

/**
* Storage name
* Storage name.
*
* @access protected
* @var string
* @var string
*/
protected $storage = 'eloquent';

/**
* Load the data from database using Eloquent ORM
* Load the data from database using Eloquent ORM.
*
* @access public
* @return void
* @access public
* @return void
*/
public function initiate()
{
Expand All @@ -38,10 +37,10 @@ public function initiate()
}

/**
* Add a finish event using Eloquent ORM
* Add a finish event using Eloquent ORM.
*
* @access public
* @return void
* @access public
* @return void
*/
public function finish()
{
Expand Down
26 changes: 12 additions & 14 deletions src/Orchestra/Memory/Drivers/Fluent.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@
class Fluent extends Driver {

/**
* Storage name
* Storage name.
*
* @access protected
* @var string
* @var string
*/
protected $storage = 'fluent';

/**
* Database table name
*
* @access protected
* @var string
* Database table name.
*
* @var string
*/
protected $table = null;
protected $table = null;

/**
* Load the data from database using Fluent Query Builder
* Load the data from database using Fluent Query Builder.
*
* @access public
* @return void
* @access public
* @return void
*/
public function initiate()
{
Expand All @@ -46,10 +44,10 @@ public function initiate()
}

/**
* Add a finish event using Fluent Query Builder
* Add a finish event using Fluent Query Builder.
*
* @access public
* @return void
* @access public
* @return void
*/
public function finish()
{
Expand Down
17 changes: 8 additions & 9 deletions src/Orchestra/Memory/Drivers/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,28 @@
class Runtime extends Driver {

/**
* Storage name
* Storage name.
*
* @access protected
* @var string
* @var string
*/
protected $storage = 'runtime';

/**
* No initialize method for runtime
* No initialize method for runtime.
*
* @access public
* @return void
* @access public
* @return return
*/
public function initiate()
{
return true;
}

/**
* No finish method for runtime
* No finish method for runtime.
*
* @access public
* @return void
* @access public
* @return return
*/
public function finish()
{
Expand Down

0 comments on commit 6a446cc

Please sign in to comment.