Download the PHP package nilportugues/cache without Composer

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

Cache layer

Build Status Coverage Status Scrutinizer Code Quality SensioLabsInsight Latest Stable Version Total Downloads License Donate

Cache layer for PHP applications capable of being used standalone or with the Chain of Responsability pattern.

1. Installation

The recommended way to install this package is through Composer. Run the following command to install it:


2. Features


3. Drivers Available

The package provides several implementations for a key-value cache.

The most sensitive choice is to make use of the Cache based adapters such as Redis and Memcached, which are the most performant and specialized.

Yet sometimes these are not available and other options should be considered, but we got you covered.

Cache based:

Full-text based:

System based:

Database based:


4. Cache and CacheAdapter Interfaces

These are all the public methods available for the Cache and all of its available adapters:

4.1 - CacheAdapter

Allows all of the public methods defined in Cache Interface.

Each CacheAdapter will have a custom constructor method due to its needs, but last parameter is always a chainable value, being another CacheAdapter.


5. Example

The more cache levels the slower the cache system will be, so leverage the 
cache to your needs. 
Maybe you don't need a fallback mechanism at all! This is just an example.

1st level cache Redis (PredisAdapter) is our main cache, in a dedicated server.

2nd level cache Memcached (MemcachedAdapter) as fallback mechanism, available in the same machine as our PHP script.

Application cache InMemoryAdapter, used to avoid hiting the external caches on repeated operations and is shared by all cache layers. This comes enabled by default so you don't need to worry at all.

5.1. Configuration

Using a Service Container, such as an array returning the services or a more popular solution such as Symfony's Service Container, build the caches.

For this example, we'll be building two caches, user_cache and image_cache. Both use Predis as first level cache and a fallback to Memcached if Predis cannot establish a connection during runtime.

5.2. Usage

Now, using a Service Container, we'll get the user_cache to fetch data, or add if it does not exist. This data will be stored in the caches.

For fetching, first it's checked if data is available in memory, if not, it's fetched from the data storage, added to the in memory cache and returned to the user.

And that's pretty much it. Notice how same key is used for the get and set methods.

5.3 Other configurations

5.3.1 ElasticSearch as cache

It is important that you configure your ElasticSearch by appending the following line to the elasticsearch.yml file:

Now restart the ElasticSearch daemon.

If you're wondering where the cache index definition is, the creation of index is handled by the adapter on instantiation if it does not already exist.

5.3.2 Sphinx as cache

Configuration provided in the /migrations/sphinx.conf file.

5.3.3 MySQL as cache

Configuration provided in the /migrations/mysql_schema.sql file.

5.3.4 Postgres as cache

Configuration provided in the /migrations/postgresql_schema.sql file.

5.3.5 Sqlite as cache

Configuration provided in the /migrations/sqlite_schema.sqlite file.


6. Quality

To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.

This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.


7. Author

Nil Portugués Calderó


8. License

The code base is licensed under the MIT license.


All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
predis/predis Version ~1.0
nilportugues/php_backslasher Version ^0.2.1
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 nilportugues/cache contains the following files

Loading the files please wait ....