Download the PHP package phpro/annotated-cache without Composer

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

Repository abandoned 2020-11-27

This repository has been archived since we are not using it anymore internally. Feel free to use it AS-IS, we won't be providing any support anymore.

Build status Insight Installs Packagist

Cache Annotations

Stop worrying about caching, use annotations instead. This PHP library makes it possible to add annotations to your services and handles caching for you. You can use any PSR-6 caching implementation as a caching back-end.

Installation

We suggest using php-cache to make it possible to add tags to your cache items.

Bridges

Usage

Example usage:

We made it as easy as possible to get started with the cache manager. You will need 3 services:

Example Service

Annotations

The bundle provides the following annotations:

@Cacheable annotation

@Cacheable annotation is used to automatically store the result of a method into the cache.

When a method demarcated with the @Cacheable annotation is called, the bundle checks if an entry exists in the cache before executing the method. If it finds one, the cache result is returned without having to actually execute the method.

If no cache entry is found, the method is executed and the bundle automatically stores its result into the cache.

@CacheEvict annotation

@CacheEvict annotation allows methods to trigger cache population or cache eviction.

When a method is demarcated with @CacheEvict annotation, the bundle will execute the method and then will automatically try to delete the cache entry with the provided key and the provided tags.

@CacheUpdate annotation

@CacheUpdate annotation is useful for cases where the cache needs to be updated without interfering with the method execution.

When a method is demarcated with @CacheUpdate annotation, the bundle will always execute the method and then will automatically try to update the cache entry with the method result.

Expression Language

For key generation, Symfony Expression Language can be used.

The Expression Language allow you to retrieve any arguments passed to your method and use it to generate the cache key. Note that you also have access to the InterceptionInterface. This means you can add other data like the instance and method to the key. For CacheUpdate and CacheEvict, you will also have access to the returnValue. Here is a little example:

Tags

It is possible to add one or multiple tags to a caching entry. Since this is not a default feature in PSR-6, you will have to implement the cache/taggable-cache TaggablePoolInterface on your cache pool.

Handling Results

It is possible to add a ResultCollectorInterface to the CacheHandler. This way you can provide your application with feedback about what happened with the annotations. By default, a dummy collector will be used that doesn't collect anything.

The results will be an instance of the ResultCollection which will contain a series of ResultInterface objects. Possible results:

Writing your own annotations

It is pretty easy to write your own annotations and let the CacheHandler intercept your own annotation. The only thing you will need to do is write your own implementation of the InterceptorInterface and a custom annotation. Next you can register this custom interceptor on the cache handler and do your own thing.

About

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub. Please take a look at our rules before contributing your code.

License

Annotated-cache is licensed under the MIT License - see the LICENSE file for details

Credits

This package is based on the TbbcCacheBundle. It uses exactly the same annotations. The big difference is that this package can be used in any PHP application.

Big ups to the Doctrine, proxy-manager and php-cache project for providing the tools that this package needs!


All versions of annotated-cache with dependencies

PHP Build Version
Package Version
Requires php Version ~7.0
doctrine/annotations Version ^1.2
doctrine/collections Version ^1.3
cache/adapter-common Version ^0.3.0
cache/taggable-cache Version ^0.4.0
ocramius/proxy-manager Version ^2.0
psr/cache Version ^1.0
symfony/expression-language Version ^3.0|^2.6
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 phpro/annotated-cache contains the following files

Loading the files please wait ....