Download the PHP package canoma/canoma without Composer

On this page you can find all versions of the php package canoma/canoma. 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 canoma

Canoma - Consistent hashing for PHP

Build Status

What is Canoma?

Canoma (CAche NOde MAnager) is a consistent hashing implementation for PHP. It aims to be an intuitive and well tested library. That allows you to easily implement consistent hashing in your caching implementation. It's completely back-end agnostic, easy to extend and free to use. It's developed using TDD.

What problems does Canoma solve?

It can act as a key component in a reliable distributed caching environment.

All your (application) caches are written to a cache-backend (For example: Redis, Membase, Memcache, etc.), by using Canoma all your keys will be written using a circular designation system. Meaning that keys are spread fairly evenly, with one huge advantage. If one server falls out, the keys will automatically be assigned to another server. This doesn't mean the "next" server, but the server that is next according to the consistent hashing algorithm.

This also works for upscaling. If another server is added, keys are simply distributed evenly again.

Usage

Requirements

PHP 5.3, 5.4 or greater. Both are being tested using Continuous Integration. The test-suite is designed with PHPUnit (3.6.*), but it will probably run on other versions. Furthermore each hashing adapter will have specific algorithm requirements. All of them should be fairly self-explanatory, (the Md5 adapter uses md5, etc..). To test if they run on your environment, simply run the test-suite:

Quick-start

The easy way is to add "canoma/canoma" to your composer.json, see: http://packagist.org/packages/canoma/canoma The alternatives are:

Example usage

This section provides some code examples about how to use Canoma. Currently Canoma has very few features, I'm aiming at stability and correctness first. After that, I'll start adding features.

Example usage

The same, but using the factory:

Some logic around dirty cache-nodes.

Drivers

Canoma uses an adapter pattern for the different hashing algorithms, there are a couple of types available:

If you want to write your own, simply implement and you're done. Be sure to send me a patch or, even better, fork the project and send a push request!

Note that certain choices have been made in the design process. One of them is to not include any checks in drivers, to ensure that a driver will actually function on your system. Doing so would introduce overhead on every request that is in essense only required once. You have to test if a certain algorithm is available. The test-suite has a large coverage and tests many cases. If certain tests are being skipped, it is probably because (e.g.) algorithms are unavailable.

Picking the right driver

Different algorithms have different benefits. Faster algorithms tend to work quite poor at distributing, with too few bytes as input, because they use less bits to calculate. This means that it's very hard (if not impossible) to fan hash-results out over the various nodes.

Choosing a hashing algorithm should be done wisely. When you're dealing with small (amount of characters) hash keys, choose a more complex algorithm (such as md5). When you're dealing with very large keys, you might want to pick a faster algorithm, such as Salsa20 or Adler32. Either way, make sure you test first, using the added script, which can be found in the directory.

The most important number to look at, is the standard deviation. The closer to 0% means that keys are spread evenly over the various nodes. However the algorithm might be slow and you might want to sacrifice an even distribution over performance.

About

What is consistent hashing?

Consistent hashing is a concept developed around 1997. The basic idea is to evenly distribute cache on distributed cache servers. To read an excellent write-up on the subject, be sure to read the following:

Acknowledgements

This library is inspired by the following projects and documents:

License

Licensed under WTFPL - read the LICENSE file.

Author


All versions of canoma with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 canoma/canoma contains the following files

Loading the files please wait ....