2017 © Pedro Peláez
 

symfony-bundle cache-bundle

Symfony2 Bundle for OpenClassrooms Cache

image

openclassrooms/cache-bundle

Symfony2 Bundle for OpenClassrooms Cache

  • Monday, February 5, 2018
  • by openclassrooms-admin
  • Repository
  • 5 Watchers
  • 0 Stars
  • 18,387 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

Build Status SensioLabsInsight Coverage Status, (*1)

CacheBundle adds features to Doctrine Cache implementation - Default lifetime - Fetch with a namespace - Save with a namespace - Cache invalidation through namespace strategy - CacheProvider Builder, (*2)

See OpenClassrooms/Cache for more details., (*3)

Installation

This bundle can be installed using composer:, (*4)

composer require openclassrooms/cache-bundle or by adding the package to the composer.json file directly., (*5)

{
    "require": {
        "openclassrooms/cache-bundle": "*"
    }
}

After the package has been installed, add the bundle to the AppKernel.php file:, (*6)

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new OpenClassrooms\Bundle\CacheBundle\OpenClassroomsCacheBundle(),
    // ...
);

Configuration

open_classrooms_cache:
    default_lifetime: 10    (optional, default = 0)
# Providers
    # array
    provider: array
    # redis            
    provider:
        redis:
            host: localhost
            port: 6379      (optional, default = 6379)
            timeout: 0.0    (optional, default = 0.0)

Usage

The configured cache is available as openclassrooms.cache.cache service:, (*7)

$cache = $container->get('openclassrooms.cache.cache');

$cache->fetch($id);
$cache->fetchWithNamespace($id, $namespaceId);
$cache->save($id, $data);
$cache->saveWithNamespace($id, $data, $namespaceId);
$cache->invalidate($namespaceId);

The configured cache provider is available as openclassrooms.cache.cache_provider service:, (*8)

$cacheProvider = $container->get('openclassrooms.cache.cache_provider');

The cache provider builder is available as openclassrooms.cache.cache_provider service:, (*9)

$builder = $container->get('openclassrooms.cache.cache_provider_builder');

// Redis
$cacheProvider = $builder
    ->create(CacheProviderType::REDIS)
    ->withHost('127.0.0.1')
    ->withPort(6379) // Default 6379
    ->withTimeout(0.0) // Default 0.0
    ->build();

See OpenClassrooms/Cache for more details., (*10)

The Versions

05/02 2018

dev-master

9999999-dev

Symfony2 Bundle for OpenClassrooms Cache

  Sources   Download

MIT

The Requires

 

The Development Requires

by OpenClassrooms
by Romain Kuzniak

05/02 2018

dev-fix_redis_boot

dev-fix_redis_boot

Symfony2 Bundle for OpenClassrooms Cache

  Sources   Download

MIT

The Requires

 

The Development Requires

by OpenClassrooms
by Romain Kuzniak