Download the PHP package cheprasov/php-memcached-tags without Composer

On this page you can find all versions of the php package cheprasov/php-memcached-tags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-memcached-tags

MIT license Latest Stable Version Total Downloads

MemcachedTags v1.0.5 for PHP >= 5.5

About

MemcachedTags for PHP is a mechanism for adding tags to keys in Memcached. It is very useful, if you need to select or delete some keys by tags. And tags are really useful for group invalidation.

Main features

How it works

I will try to explain a mechanism, how memcached stores tags.

Imagine, you have some 3 keys in memcached (user1, user2, user3):

Now, lets add tag 'London' to users:

And, as result, the memcached will contain:

And, lets add tags 'male' and 'female' to users:

And, as result, the memcached will contain:

Usage

Methods

MemcachedTags :: __construct ( \Memcached $Memcached , array $config = null )


Create a new instance of MemcachedTags.

Method Parameters
  1. \Memcached $Memcached - Instance of Memcached
  2. array $config, default = null
    • prefix - is a prefix for service keys in Memcached storage, like namespace.
    • separator - special char(s) that , by default ||. It is service parameter for the gluing of tags to the Memcached. This value should not use in the name tags or keys.
Example

bool MemcachedTags :: addTagsToKeys ( string|string[] $tags , string|string[] $keys )


Adds each key specified tags. Returns true on success or false on failure.

Method Parameters
  1. string|string[] $tags - Tag or list of tags that will be added to each key.
  2. string|string[] $keys - Existing keys in Memcached for tags
Example

int MemcachedTags :: deleteKey ( string $key )


Delete key and update dependent tags. Returns count of deleted keys (0 or 1).

Method Parameters
  1. string $key - Name of key.
Example

int MemcachedTags :: deleteKeys ( string[] $keys )


Delete keys and update dependent tags. Returns count of deleted keys.

Method Parameters
  1. string[] $keys - List of keys.
Example

int MemcachedTags :: deleteTag ( string $tag )


Delete tag. Keys will be not affected. Returns count of deleted tags. (0 or 1)

Method Parameters
  1. string $tag - Name of tag.
Example

int MemcachedTags :: deleteTags ( string[] $tags )


Delete several tags. Keys will be not affected. Returns count of deleted tags.

Method Parameters
  1. string[] $tags - List of tags
Example

int MemcachedTags :: deleteKeysByTag ( string $tag )


Delete keys by tag. Returns count of deleted keys.

Method Parameters
  1. string tag - Name of tag.
Example

int MemcachedTags :: deleteKeysByTags ( string[] $tags [, int $compilation = MemcachedTags::COMPILATION_ALL] )


Delete keys by several tags. Returns count of deleted keys.

Method Parameters
  1. string[] tags - List of tags
  2. int $compilation, default = MemcachedTags::COMPILATION_ALL - The method of combining tags.
    • MemcachedTags::COMPILATION_ALL - The same as MemcachedTags::COMPILATION_OR.
    • MemcachedTags::COMPILATION_AND - Delete keys that have every tags.
    • MemcachedTags::COMPILATION_OR - Delete keys that have any tags.
    • MemcachedTags::COMPILATION_XOR - Delete keys containing tag1 that are not have any of the other tags.
Example

string[] MemcachedTags :: getKeysByTag ( string $tag )


Returns a list of keys with tag.

Method Parameters
  1. string tag - Name of tag.
Example

string[]|array MemcachedTags :: getKeysByTags ( string[] $tags [, int $compilation = MemcachedTags::COMPILATION_ALL] )


Returns a list of keys by several tags.

Method Parameters
  1. string[] tags - List of tags.
  2. int $compilation, default = MemcachedTags::COMPILATION_ALL - The method of combining tags.
    • MemcachedTags::COMPILATION_ALL - Returns array with keys for every tag. array(tag1 => [key1, key2], ...)
    • MemcachedTags::COMPILATION_AND - Returns a list of keys that have every tags.
    • MemcachedTags::COMPILATION_OR - Returns a list of keys that have any tags.
    • MemcachedTags::COMPILATION_XOR - Returns a list of keys containing tag1 that are not have any of the other tags.
Example

string[] MemcachedTags :: getTagsByKey ( string $key )


Returns list of tags or empty list.

Method Parameters
  1. string $key - Key in Memcached.
Example

bool MemcachedTags :: setKeyWithTags ( string $key , string $value , string|string[] $tags )


Set value and tags to key. Returns result as bool.

Method Parameters
  1. string $key - The key under which to store the value.
  2. string $value - The value to store.
  3. string|string[] $tags - Tag or list of tags for the key.
Example

bool MemcachedTags :: setKeysWithTags ( array $items , string|string[] $tags )


Set values and tags to several keys. Returns result as bool.

Method Parameters
  1. string $items - An array of key/value pairs to store on the server.
  2. string|string[] $tags - Tag or list of tags for the items.
Example

Installation

Composer

Download composer:

wget -nc http://getcomposer.org/composer.phar

and add dependency to your project:

php composer.phar require cheprasov/php-memcached-tags

Running tests

To run tests type in console:

./vendor/bin/phpunit ./test/

Something doesn't work

Feel free to fork project, fix bugs and finally request for pull


All versions of php-memcached-tags with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
cheprasov/php-memcached-lock Version ~1.0.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cheprasov/php-memcached-tags contains the following files

Loading the files please wait ....