Download the PHP package tbbc/cache-bundle without Composer

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

CacheBundle

Add cache abstraction and method annotations for controlling cache. The current implementation of the Cache component is a wrapper (proxy) for Doctrine\Common\Cache.

State

Build Status Scrutinizer Code Quality Downloads Stable release

Overview

The TbbcCacheBundle integrates Symfony with a non-instrusive applicative cache management system. It gives to the developer annotation driven cache control by using AOP mechanisms and PHP language expressions.

Features

Documentation

Installation

First, install the bundle package with composer:

Next, activate the bundle into app/AppKernel.php:

Configuration

Note: The tbbc_cache.cache_eligible tag is mandatory in your service definition if you want to be able to use annotation for this service.

Usage

Annotation based caching (recommanded)

Recommended

If some prefer to avoid repeating code each time they want to add some caching logic, the bundle can automate the process by using AOP approach and 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.

It is also possible to flush completely the caches by setting allEntries parameter to true

:warning: Important note: when using the allEntries option you have to be really careful, if you use the same cache manager for different namespace, the whole cache manager will be flushed. This is currently a limitation of the underlying Doctrine Cache library.

Note: If you also provide a key, it will be ignored and the cache will be flushed.

@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.

Standard cache usage (without annotations)

CacheManager instance must be injected into services that need cache management.

The CacheManager gives access to each configured cache (see Configuration section). Each cache implements CacheInterface.

Usage:

Custom Cache Manager

Out of the box, the bundle provides a SimpleCacheManager, but custom cache managers can be used instead of the default one and must implement the CacheManagerInterface.

Key generation

Key generation is up to the developer, but for convenience, the bundle comes with some key generation logic.

Note: When using Annotation based caching, usage of Key generators is mandatory.

Out of the box, the bundle provides a SimpleHashKeyGenerator which basically adds each param encoded using md5 algorithm, and returned a md5 hash of the result.

For testing purpose you may also use LiteralKeyGenerator which build a slug-like key.

Note: Both generators does not support non-scalar keys such as objects.

You can override the Key Generator by setting the key_generator key in your config.yml

Allowed values are: simple_hash, literal or the id of the service of your custom Key generator

Custom Key generation

Custom key generators can be used instead of the default one and must implement the KeyGeneratorInterface.

TTL Strategy

Since this bundle provides a cache abstraction and not all cache providers support or handle TTL the same way, TTL strategy must be defined in each cache configuration options (when option is supported).

Example:

Symfony debug toolbar integration

Debugging cache operations is often a pain is the ass. In order to facilitate this work, the bundle adds some useful live information directly in the Symfony Debug Toolbar.

Here are some screenshots about the kind of information it will show:

Known limitations

CacheEvict operation with "allEntries" option

Due to the way cache is managed in Doctrine and especially the way it is handled by the different cache systems, usage of the "CacheEvict" operation with the "allEntries" option can lead to undesired behaviour.

Be warned that if you use different cache namespaces but within the same cache instance (like a single memcached server for instance), the "allEntries" option will flush all cache entries in all namespaces. Meaning it will flush the entire instance cache.

Doctrine entities caching

Automatic caching of doctrine entities is not supported at this time. If you need to cache entities, you have to implement your own logic.

One way to do it would be to override annotations and metadatas for adding a serialization "type" option, and then hook in cache events to manually manage serialization/de-serialization operations:

Testing

Install development dependencies

Run the test suite

License

This bundle is under the MIT license. See the complete license in the bundle:

Resources/meta/LICENSE

The Big Brains Company - Logo


All versions of cache-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version >=2.0
doctrine/cache Version >=1.0
jms/metadata Version 1.*
jms/aop-bundle Version >=1.0.0,<1.2-dev
symfony/expression-language Version ~2.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 tbbc/cache-bundle contains the following files

Loading the files please wait ....