Download the PHP package clickalicious/memcached.php without Composer
On this page you can find all versions of the php package clickalicious/memcached.php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clickalicious/memcached.php
More information about clickalicious/memcached.php
Files in clickalicious/memcached.php
Package memcached.php
Short Description Memcached.php - Plain vanilla PHP Memcached client with full support of Memcached protocol.
License BSD-3-Clause
Homepage https://github.com/clickalicious/Memcached.php
Informations about the package memcached.php
Plain vanilla PHP Memcached
client library with full support of Memcached ASCII protocol
Table of Contents
- Features
- Example
- Requirements
- Philosophy
- Versioning
- Roadmap
- Security-Issues
- License »
Features
- ~ 100% of
Memcached
ASCII-protocol specification covered - Support for storing native PHP variable types (arrays, objects ...)
- Increment & Decrement support
- Efficient connection sharing
- Configurable connection close behavior
- Clean & well documented code
- Unit-Tested
Memcached.php covers almost 100% of the Memcached
protocol specification. The code is clean, full documented and developed following the PSR coding standards (PSR-0/4, PSR-1, PSR-2). The code is unit-tested (PHPUnit) and the coverage is high. The library supports \<incr> and \<decr> command on stored integers (strings) and the connection handling is done like recommended in the Memcached
protocol specification. Last but not least it supports seven of PHP's eight variable types - in detail four scalar types:
boolean
integer
float (floating-point number [double])
string
two compound types:
array
object
and finally one special type:
NULL
So resource
is the only type not supported.
Example
- Create a
client
instance and connect it (lazy) toMemcached
daemon on host 127.0.0.1 (on default port [11211]) - Set key foo with value 1.00
- Retrieve value for key foo
You will find a demonstration Demo.php
showing in detail how to use the Memcached.php client
.
Requirements
PHP >= 5.4
(compatible up to version 5.6 as well as 7.x - but not compatible with HHVM)
Philosophy
This client is neither tested nor designed to be used in heavy load environments. It was designed and developed by me as a client library for my phpMemAdmin project. So I was able to remove dependencies of both Memcache
+ Memcached
(PECL) extensions - both are designed in a way i don't like. I've tried to align 100% with the Memcached protocol specification. In some cases I didn't liked the naming convention and so I created some proxies. As an example - I decided to implement increment() as proxy to incr() and decrement() as proxy to decr(). I will add some more responsibilities in some more classes like a PSR compatible Caching proxy and a Pool/Cluster Class for management operations soon.
Versioning
For a consistent versioning i decided to make use of Semantic Versioning 2.0.0
http://semver.org. Its easy to understand, very common and known from many other software projects.
Roadmap
- [x] Target stable release
1.0.0
- [x]
>= 90%
test coverage - [ ] Security check through 3rd-Party (Please get in contact with me)
Installation
The recommended way to install this library is through Composer. Require the clickalicious/memcached.php
package into your composer.json
file:
Memcached.php is also available as download from github packed as zip-file or via git clone https://github.com/clickalicious/Memcached.php.git .
Data
Strings
, Integers
and Float-Values
are never modified by this library in any way. Those types will be stored by Memcached
's internal system - while all other types will be serialized by this client and can optionally be stored compressed (LZW/Smaz) - in one of the next releases of this library - targeting 0.4.0. I'm working on an PoC implementation of Smaz - a short string compression library
(https://github.com/zhenhao/smaz.php) and on a german translation of the translation table used by Smaz
.
Metadata
Memcached
provides a 32 Bit (Version > 1.2.1) unsigned Integer field for meta data. From the Memcached
protocol specification:
Note that in memcached 1.2.1 and higher, flags may be 32-bits, instead of 16, but you might want to restrict yourself to 16 bits for compatibility with older versions.
Memcached.php uses this field for its meta data. The meta data is required to mark data for serialization and stuff like this. This meta data is stored via the clients` flags field. The lower first 8 Bits (lowest Byte) are reserved by Memcached.php. The other 8 Bits (half of the 16 Bits) can be used by your app.
Documentation
The best and currently only existing documentation is the inline documentation of this project. So please have a look at the source to understand how Memcached.php works internally.
Tests
Memcached.php is unit-tested and the code coverage is high. For an in-detail view have a look at this always up to date Code Coverage report.
Running the Tests
You will find a PHPUnit configuration including testsuites in directory tests/
. To run those configuration execute the following command on cli
:
Tests
The unit-tests are fired against an existing and real Memcached
daemon. Please be aware that you need a running Memcached
deamon on the host you run the unit-tests listening on the default port (11211). In Result the unit-tests are not that isolated cause they are bound to a running Memcached
daemon and network as well.
Versioning
For a consistent versioning i decided to make use of Semantic Versioning 2.0.0
http://semver.org. Its easy to understand, very common and known from many other software projects.
Roadmap
- [ ] Hardening code - more stability!
- [ ]
\Clickalicious\Memcached\Proxy
This should become a proxy implementation which is able to act asMemcache
orMemcached
(both PECL) extension (emulate) for testing (primary mocking/stubbing). - [ ]
\Clickalicious\Memcached\Server
This should become a virtual (emulated) mode which emulates a completeMemcached
backend. - [ ] Add compression support to be able to manipulate PECL Memcached stored data (FastLZ, zlib, LZW)
- [ ] Replace explodes and array operations for data anlysis with regular expressions.
- [ ] Increase coverage and cover (currently unused compression classes) more parts.
If you are interested in any of these features too - please let me know. Maybe we can adjust the priority and speed things up ...
Participate & share
... yeah. If you're a code monkey too - maybe we can build a force ;) If you would like to participate in either Code, Comments, Documentation, Wiki, Bug-Reports, Unit-Tests, Bug-Fixes, Feedback and/or Critic then please let me know as well!
Sponsors
Thanks to our sponsors and supporters:
JetBrains | Navicat |
---|---|