Skip to content
Browse files

Updated docs for titon\libs\storage

  • Loading branch information...
1 parent 793f74f commit 5a0d1760ecc7e1972636aae5192fcaedb81e653b @milesj milesj committed
View
3 libs/storage/StorageAbstract.php
@@ -35,8 +35,7 @@
* Configuration.
*
* id - Unique ID for specific engines
- * server - Singular server to store data in
- * servers - List of servers to store data in
+ * server - Server(s) to connect and store data in
* serialize - Toggle data serialization
* compress - Toggle data compression
* persistent - Toggle persistent server connections
View
3 libs/storage/cache/ApcStorage.php
@@ -18,6 +18,7 @@
* This engine can be installed using the Cache::setup() method. No configuration options are available for this engine.
*
* @package titon.libs.storage.cache
+ *
* @link http://pecl.php.net/package/apc
*/
class ApcStorage extends StorageAbstract {
@@ -83,7 +84,7 @@ public function increment($key, $step = 1) {
*
* @access public
* @return void
- * @throws StorageException
+ * @throws \titon\libs\storage\StorageException
*/
public function initialize() {
if (!Titon::load('apc')) {
View
12 libs/storage/cache/MemcacheStorage.php
@@ -15,12 +15,12 @@
use \Memcache;
/**
- * A storage engine for the Memcache module, using the Memcache class; requires pecl/memcached.
+ * A storage engine for the Memcache key-value store; requires pecl/memcached.
* This engine can be installed using the Cache::setup() method.
*
* {{{
* new MemcacheStorage(array(
- * 'servers' => 'localhost:11211',
+ * 'server' => 'localhost:11211',
* 'persistent' => true,
* 'compress' => true
* ));
@@ -106,7 +106,7 @@ public function increment($key, $step = 1) {
*
* @access public
* @return void
- * @throws StorageException
+ * @throws \titon\libs\storage\StorageException
*/
public function initialize() {
if (!Titon::load('memcache')) {
@@ -115,8 +115,8 @@ public function initialize() {
$config = $this->config->get();
- if (empty($config['servers'])) {
- return;
+ if (!$config['server']) {
+ throw new StorageException(sprintf('No server has been defined for %s.', $this->info->className()));
}
if ($config['compress']) {
@@ -125,7 +125,7 @@ public function initialize() {
$this->connection = $this->connection ?: new Memcache();
- foreach ((array) $config['servers'] as $server) {
+ foreach ((array) $config['server'] as $server) {
if (is_array($server)) {
$server = implode(':', $server);
}
View
18 libs/storage/cache/MemcachedStorage.php
@@ -15,19 +15,19 @@
use \Memcached;
/**
- * A storage engine for the Memcache module, using the Memcached class; requires pecl/memcached.
+ * A storage engine for the Memcache key-value store; requires pecl/memcached module.
* This engine can be installed using the Cache::setup() method.
*
* {{{
* new MemcachedStorage(array(
* 'id' => 'default',
- * 'servers' => 'localhost:11211',
+ * 'server' => 'localhost:11211',
* 'compress' => true
* ));
* }}}
*
* A sample configuration can be found above, and the following options are available:
- * id, servers (array or string), compress, serialize, prefix, expires.
+ * id, server (array or string), compress, serialize, prefix, expires.
*
* @package titon.libs.storage.cache
*
@@ -51,7 +51,7 @@ public function has($key) {
*
* @access public
* @return void
- * @throws StorageException
+ * @throws \titon\libs\storage\StorageException
*/
public function initialize() {
if (!Titon::load('memcache')) {
@@ -60,8 +60,8 @@ public function initialize() {
$config = $this->config->get();
- if (empty($config['servers'])) {
- return;
+ if (!$config['server']) {
+ throw new StorageException(sprintf('No server has been defined for %s.', $this->info->className()));
}
$this->connection = $this->connection ?: new Memcached($config['id']);
@@ -74,14 +74,14 @@ public function initialize() {
$this->connection->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY);
}
- if (is_array($config['servers'])) {
+ if (is_array($config['server'])) {
$serverList = $this->connection->getServerList();
if (empty($serverList)) {
- $this->connection->addServers($config['servers']);
+ $this->connection->addServers($config['server']);
}
} else {
- list($host, $port, $weight) = explode(':', $config['servers']);
+ list($host, $port, $weight) = explode(':', $config['server']);
$this->connection->addServer($host, $port ?: self::PORT, $weight ?: self::WEIGHT);
}
View
4 libs/storage/cache/RedisStorage.php
@@ -100,7 +100,7 @@ public function increment($key, $step = 1) {
*
* @access public
* @return void
- * @throws StorageException
+ * @throws \titon\libs\storage\StorageException
*/
public function initialize() {
if (!Titon::load('redis')) {
@@ -109,7 +109,7 @@ public function initialize() {
$config = $this->config->get();
- if (empty($config['server'])) {
+ if (!$config['server']) {
throw new StorageException(sprintf('No server has been defined for %s.', $this->info->className()));
}
View
2 libs/storage/cache/WincacheStorage.php
@@ -84,7 +84,7 @@ public function increment($key, $step = 1) {
*
* @access public
* @return void
- * @throws StorageException
+ * @throws \titon\libs\storage\StorageException
*/
public function initialize() {
if (!Titon::load('wincache')) {
View
2 libs/storage/cache/XcacheStorage.php
@@ -117,7 +117,7 @@ public function increment($key, $step = 1) {
*
* @access public
* @return void
- * @throws StorageException
+ * @throws \titon\libs\storage\StorageException
*/
public function initialize() {
if (!Titon::load('xcache')) {

0 comments on commit 5a0d176

Please sign in to comment.
Something went wrong with that request. Please try again.