From 904ee1b8b9dcb3b52207c7b17c8e907c0fa77265 Mon Sep 17 00:00:00 2001 From: Adam Balogh Date: Mon, 13 Oct 2014 13:06:51 -0400 Subject: [PATCH] refresh to 0.4.0 --- composer.json | 4 +- composer.lock | 271 +++++++++--------------- readme.md | 16 ++ src/Adapter/FileAdapter/KeyTrait.php | 8 +- src/Adapter/FileAdapter/StringTrait.php | 6 +- 5 files changed, 128 insertions(+), 177 deletions(-) diff --git a/composer.json b/composer.json index fc308f1..5f44f74 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ ], "require": { "php": ">=5.4.0", - "adammbalogh/key-value-store": "0.3.*", - "fire015/flintstone": "~1.6" + "adammbalogh/key-value-store": "~0.4.0", + "fire015/flintstone": "~1.6.0" }, "require-dev": { "phpunit/phpunit": "~4.2.5", diff --git a/composer.lock b/composer.lock index e885a88..1000893 100644 --- a/composer.lock +++ b/composer.lock @@ -4,26 +4,27 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c4995a07462db44b8fa2d421c74a74a5", + "hash": "e285186757e107025d06ad132413f94c", "packages": [ { "name": "adammbalogh/key-value-store", - "version": "0.3.3", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/adammbalogh/key-value-store.git", - "reference": "716fd53f706c64a5ef89ff0695628d9407e625da" + "reference": "97e67e9cfe8011722ee1d74578dc97e6e4328e84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/adammbalogh/key-value-store/zipball/716fd53f706c64a5ef89ff0695628d9407e625da", - "reference": "716fd53f706c64a5ef89ff0695628d9407e625da", + "url": "https://api.github.com/repos/adammbalogh/key-value-store/zipball/97e67e9cfe8011722ee1d74578dc97e6e4328e84", + "reference": "97e67e9cfe8011722ee1d74578dc97e6e4328e84", "shasum": "" }, "require": { "php": ">=5.4.0" }, "require-dev": { + "mockery/mockery": "~0.9.2", "phpmd/phpmd": "~2.1", "phpunit/phpunit": "~4.2.5", "satooshi/php-coveralls": "dev-master", @@ -32,6 +33,7 @@ "suggest": { "adammbalogh/key-value-store-file": "For using File storage", "adammbalogh/key-value-store-memcached": "For using Memcached storage", + "adammbalogh/key-value-store-null": "For using Null storage", "adammbalogh/key-value-store-redis": "For using Redis storage" }, "type": "library", @@ -60,7 +62,7 @@ "store", "value" ], - "time": "2014-09-29 16:59:36" + "time": "2014-10-13 16:30:14" }, { "name": "fire015/flintstone", @@ -108,6 +110,60 @@ } ], "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.0.*@ALPHA" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Instantiator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2014-10-13 12:58:55" + }, { "name": "guzzle/guzzle", "version": "v3.9.2", @@ -238,119 +294,6 @@ "homepage": "http://vfs.bovigo.org/", "time": "2014-09-14 10:18:53" }, - { - "name": "ocramius/instantiator", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/Instantiator.git", - "reference": "e24a12178906ff2e7471b8aaf3a0eb789b59f881" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/e24a12178906ff2e7471b8aaf3a0eb789b59f881", - "reference": "e24a12178906ff2e7471b8aaf3a0eb789b59f881", - "shasum": "" - }, - "require": { - "ocramius/lazy-map": "1.0.*", - "php": "~5.3" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Instantiator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/Ocramius/Instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2014-08-25 14:48:16" - }, - { - "name": "ocramius/lazy-map", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/LazyMap.git", - "reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/7fe3d347f5e618bcea7d39345ff83f3651d8b752", - "reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "athletic/athletic": "~0.1.6", - "phpmd/phpmd": "1.5.*", - "phpunit/phpunit": ">=3.7", - "satooshi/php-coveralls": "~0.6", - "squizlabs/php_codesniffer": "1.4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "LazyMap\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/", - "role": "Developer" - } - ], - "description": "A library that provides lazy instantiation logic for a map of objects", - "homepage": "https://github.com/Ocramius/LazyMap", - "keywords": [ - "lazy", - "lazy instantiation", - "lazy loading", - "map", - "service location" - ], - "time": "2013-11-09 22:30:54" - }, { "name": "phpunit/php-code-coverage", "version": "2.0.11", @@ -674,25 +617,25 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.2.1", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "b241b18d87a47093f20fae8b0ba40379b00bd53a" + "reference": "c63d2367247365f688544f0d500af90a11a44c65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b241b18d87a47093f20fae8b0ba40379b00bd53a", - "reference": "b241b18d87a47093f20fae8b0ba40379b00bd53a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", + "reference": "c63d2367247365f688544f0d500af90a11a44c65", "shasum": "" }, "require": { - "ocramius/instantiator": "~1.0", + "doctrine/instantiator": "~1.0,>=1.0.1", "php": ">=5.3.3", "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "~4.3" }, "suggest": { "ext-soap": "*" @@ -700,7 +643,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "2.3.x-dev" } }, "autoload": { @@ -725,7 +668,7 @@ "mock", "xunit" ], - "time": "2014-09-06 17:32:37" + "time": "2014-10-03 05:12:11" }, { "name": "psr/log", @@ -842,16 +785,16 @@ }, { "name": "sebastian/comparator", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2" + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", - "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", "shasum": "" }, "require": { @@ -878,11 +821,6 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -894,6 +832,10 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -903,7 +845,7 @@ "compare", "equality" ], - "time": "2014-05-02 07:05:58" + "time": "2014-05-11 23:00:21" }, { "name": "sebastian/diff", @@ -959,28 +901,28 @@ }, { "name": "sebastian/environment", - "version": "1.0.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a" + "reference": "6288ebbf6fa3ed2b2ff2d69c356fbaaf4f0971a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a", - "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6288ebbf6fa3ed2b2ff2d69c356fbaaf4f0971a7", + "reference": "6288ebbf6fa3ed2b2ff2d69c356fbaaf4f0971a7", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.0.*@dev" + "phpunit/phpunit": "~4.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -995,8 +937,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], "description": "Provides functionality to handle HHVM/PHP environments", @@ -1006,27 +947,27 @@ "environment", "hhvm" ], - "time": "2014-02-18 16:17:19" + "time": "2014-10-07 09:23:16" }, { "name": "sebastian/exporter", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529" + "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", - "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", + "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.0.*@dev" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { @@ -1044,11 +985,6 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1057,14 +993,17 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net", - "role": "Lead" - }, { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1073,7 +1012,7 @@ "export", "exporter" ], - "time": "2014-02-16 08:26:31" + "time": "2014-09-10 00:51:36" }, { "name": "sebastian/version", @@ -1487,9 +1426,7 @@ "time": "2014-09-22 09:14:18" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", "stability-flags": { "satooshi/php-coveralls": 20 @@ -1498,7 +1435,5 @@ "platform": { "php": ">=5.4.0" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/readme.md b/readme.md index bb42d7e..92d3ddf 100644 --- a/readme.md +++ b/readme.md @@ -16,6 +16,8 @@ This library provides a layer to a key value file store. It uses the [fire015/flintstone](https://github.com/fire015/flintstone) package. +Check out the [abstract library](https://github.com/adammbalogh/key-value-store) to see the other adapters and the Api. + # Installation Install it through composer. @@ -53,6 +55,20 @@ $kvs->get('sample_key'); **Please visit the [API](https://github.com/adammbalogh/key-value-store#api) link in the abstract library.** +# Toolset + +| Key | String | Server | +|------------------ |---------------------|------------------| +| ✔ delete | ✔ append | ✔ flush | +| ✔ expire | ✔ decrement | | +| ✔ getKeys | ✔ decrementBy | | +| ✔ getTtl | ✔ get | | +| ✔ has | ✔ getValueLength | | +| ✔ persist | ✔ increment | | +| | ✔ incrementBy | | +| | ✔ set | | +| | ✔ setIfNotExists | | + # Support [![Support with Gittip](http://img.shields.io/gittip/adammbalogh.svg?style=flat)](https://www.gittip.com/adammbalogh/) diff --git a/src/Adapter/FileAdapter/KeyTrait.php b/src/Adapter/FileAdapter/KeyTrait.php index d527cc7..80598e1 100644 --- a/src/Adapter/FileAdapter/KeyTrait.php +++ b/src/Adapter/FileAdapter/KeyTrait.php @@ -1,6 +1,6 @@ set($key, Helper::getDataWithExpire($value, $seconds, time())); + return $this->set($key, Util::getDataWithExpire($value, $seconds, time())); } /** @@ -66,7 +66,7 @@ public function getTtl($key) $getResult = $this->getValue($key); $unserialized = @unserialize($getResult); - if (!Helper::hasInternalExpireTime($unserialized)) { + if (!Util::hasInternalExpireTime($unserialized)) { throw new \Exception('Cannot retrieve ttl'); } @@ -111,7 +111,7 @@ public function persist($key) $unserialized = @unserialize($getResult); - if (!Helper::hasInternalExpireTime($unserialized)) { + if (!Util::hasInternalExpireTime($unserialized)) { throw new \Exception("{$key} has no associated timeout"); } diff --git a/src/Adapter/FileAdapter/StringTrait.php b/src/Adapter/FileAdapter/StringTrait.php index dcf218a..3e36d5b 100644 --- a/src/Adapter/FileAdapter/StringTrait.php +++ b/src/Adapter/FileAdapter/StringTrait.php @@ -1,6 +1,6 @@ getValue($key); $unserialized = @unserialize($getResult); - if (Helper::hasInternalExpireTime($unserialized)) { + if (Util::hasInternalExpireTime($unserialized)) { $this->handleTtl($key, $unserialized['ts'], $unserialized['s']); @@ -116,7 +116,7 @@ public function incrementBy($key, $increment) { $storedValue = $this->get($key); - Helper::checkInteger($storedValue); + Util::checkInteger($storedValue); $this->set($key, (string)($storedValue + $increment));