Symfony2 Bundle for Doctrine Cache



Symfony Bundle for Doctrine Cache.

Master: Build Status

Master: Coverage Status

Deprecation warning

This bundle is abandoned and will no longer be updated. If you want to use doctrine/cache in Symfony, please configure the services manually. When using Symfony, we no longer recommend configuring doctrine/cache through this bundle. Instead, you should use symfony/cache for your cache needs. However, the deprecation does not extend to doctrine/cache, you'll be able to use those classes as you did so far.

  • Deprecation of DoctrineCacheBundle

    Deprecation of DoctrineCacheBundle

    After evaluation, we have decided that we will not adapt this bundle for compatibility with Symfony 5. We will provide limited support while people continue to use it with Symfony 3.4 LTS and supported versions of Symfony 4, but we actively suggest people don't use this bundle anymore to configure caches from Symfony 5 onwards.

    With Symfony 3.4, the Symfony Cache Component was introduced, along with a very simple way to configure it using FrameworkBundle. Unlike doctrine/cache, this component is compatible with the PHP-FIG cache standards (PSR-6 and PSR-16). With this in mind, symfony/cache is more interoperable than doctrine/cache, which was always specifically tailored to the needs of the Doctrine projects.

    Last but not least, the cache bundle is no longer needed to configure caches for the DoctrineBundle: the current Symfony Flex recipe already configures symfony/cache adapters for ORM, and the new version of the bundle for ORM will support configuring a symfony/cache straight from the configuration. With all this in mind, there is no point allowing to configure doctrine/cache for anything other than it was originally intended to be used, which renders this bundle obsolete.

    Please note that while we are preparing for DoctrineBundle to no longer depend on this bundle, we welcome feedback from the community on the deprecation of DoctrineCacheBundle. Please let us know if you are actively using this bundle to configure caches for usages outside of doctrine/orm. If you don't have a doctrine_cache node in your Symfony configuration, this deprecation will most likely not affect you at all. If you do, we'd appreciate your input.

    opened by alcaeus 16
  • doctrine:cache:clear Fatal error: Class 'Memcached' not found

    doctrine:cache:clear Fatal error: Class 'Memcached' not found

    Hello With Symfony 3.3 whenever I try any combination of doctrine:cache:clear ( dev/prod), it will throw the error

    PHP Fatal error: Class 'Memcached' not found in /Users/user/Sites/Symfony1/vendor/doctrine/doctrine-cache-bundle/Tests/Functional/Fixtures/Memcached.php on line 6

    Also, I read somewhere that doctrine-cache-bundle might require doctrine-fixtures-bundle, and I tried to install that, but again the same error is thrown on installation as per:

    An error occurred when executing the "'cache:clear --no-warmup'" command:

    I do have Memcached extension enabled on php ( Memcached version 3.0.4 as per phpinfo() ). Actually I am using Symfony's memcached adapter to cache query results per :

    use Symfony\Component\Cache\Adapter\MemcachedAdapter;

    I have to say that I am more than a bit confused with the overlap between Symfony's cache, ORM cache and doctrine-cache-bundle. Not sure If or how to use them together and the documentation is not at all clear.

    In any case, here is my config.yml

    ` framework: cache: app: cache.adapter.memcached default_memcached_provider: "memcached://" ... orm: ... entity_managers: default: metadata_cache_driver: memcached result_cache_driver: type: memcached host: port: 11211 instance_class: Memcached query_cache_driver: memcached

    doctrine_cache: aliases: mem_cached_meta: my_memcached_cache_metadata mem_cached_query: my_memcached_cache_query mem_cached_result: my_memcached_cache_result providers: my_memcached_cache_metadata: type: memcached namespace: metadata_cache_ns aliases: - mem_cached_meta my_memcached_cache_query: type: memcached namespace: query_cache_ns aliases: - mem_cached_query my_memcached_cache_result: type: memcached namespace: result_cache_ns aliases: - mem_cached_result`

    opened by BernardA 15
  • Missing default command name in DI tags

    Missing default command name in DI tags

    As I just installed Symfony 3.4, I get the following error:

    Call to undefined method Doctrine\Bundle\DoctrineCacheBundle\Command\ContainsCommand::getDefaultName()

    I believe this can be solved by updating the tags for the service definitions of the commands in Resources/services.xml

            <service id="doctrine_cache.contains_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\ContainsCommand">
                <tag name="console.command" />
            <service id="doctrine_cache.delete_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\DeleteCommand">
                <tag name="console.command" />
            <service id="doctrine_cache.flush_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\FlushCommand">
                <tag name="console.command" />
            <service id="doctrine_cache.stats_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\StatsCommand">
                <tag name="console.command" />

    Would become:

            <service id="doctrine_cache.contains_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\ContainsCommand">
                <tag name="console.command" command="doctrine:cache:contains" />
            <service id="doctrine_cache.delete_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\DeleteCommand">
                <tag name="console.command" command="doctrine:cache:delete" />
            <service id="doctrine_cache.flush_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\FlushCommand">
                <tag name="console.command" command="doctrine:cache:flush" />
            <service id="doctrine_cache.stats_command" class="Doctrine\Bundle\DoctrineCacheBundle\Command\StatsCommand">
                <tag name="console.command" command="doctrine:cache:stats" />
    opened by janmartendeboer 11
  • Add option 'public' to cache providers

    Add option 'public' to cache providers

    in case cache provider only use on other services argument, so i dont need that provider set as public service.

    for example i use doctrine cache for caching the validation metadata

    # service.yml
            class: "Symfony\\Component\\Validator\\Mapping\\Cache\\DoctrineCache"
            arguments: ["@doctrine_cache.providers.validation_cache"]
            public: false
    # config.yml
                namespace: "validation_cache:"
                    host: "..."
                    port: "..."
                    database: "..."
            cache: app.cache.validation

    the service doctrine_cache.providers.validation_cache just as other service arguments.

    so i think it would be great if it can set as 'public' option

    # config.yml
                namespace: "validation_cache:"
                    host: "..."
                    port: "..."
                    database: "..."
                public: false
    opened by IndraGunawan 10
  • Allow providers to be loaded lazy

    Allow providers to be loaded lazy

    Currently, providers are not loaded lazy and there's no easy way (or I didn't find out) to let them load lazy. The problem is, that if you inject such a provider into a class in symfony, there is no easy way to catch an exception happening during constructing the class. And at least in the redis provider, an exception happens simply when the redis server is not reachable (which for a cache shouldn't lead in an not easy catchable exception). When lazy loading the provider, we can handle this case with a common try/catch construct in the get/set calls

    Won't Fix 
    opened by chregu 9
  • Can not define Predis scheme config.yml for cache drivers

    Can not define Predis scheme config.yml for cache drivers

    [Symfony\Component\Debug\Exception\ContextErrorException] Notice: Undefined index: scheme in /vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/PredisDefinition.php line 49

    possibly after 8290005dd8366484e61a47b62ee75f4fe18abede


                            type: predis
                        enabled: true
    opened by Avtonom 9
  • Moving security-acl to an optional dependency

    Moving security-acl to an optional dependency

    Fixes #76

    I believe symfony/security-acl isn't used by anything, but this bundle provides a cache layer for it (if you're using it).

    This should also help


    opened by weaverryan 9
  • [WIP] Add logging and DataCollector

    [WIP] Add logging and DataCollector



    • A service tag is added to provider services in the extension.
    • A compiler pass is used to replace the provider class with a proxy. For performance, this only happens if the kernel is in debug mode.
    • The proxies log certain calls and data to a central LogMaster.
    • The DataCollector uses the LogMaster to retrieve and display data in the debug toolbar and panel.
    • The LogMaster can be retrieved and used for any other purpose that needs access the logs.

    To do:

    • [ ] Need a icon for the debug toolbar.
    • [x] Finish profiler panel display
    • [x] Doc blocks
    • [ ] Tests
    • [x] General cleanup

    ... more

    opened by dragonwize 9
  • question: Metadata caching fails on PHP7 phpredis

    question: Metadata caching fails on PHP7 phpredis

    Metadata caching fails on PHP7 phpredis because of igbinary. So is there a way to change default RedisCache so that serializer is Redis::SERIALIZER_PHP and not Redis::SERIALIZER_IGBINARY ?

    I don't want to recompile a phpredis extension without igbinary in it.

    Question Won't Fix 
    opened by Jarablus 7
  • allow to use persistent redis connections

    allow to use persistent redis connections

    New persistent configuration option for Redis introduced. It allows the connection to be persistent by internally switching connection method from \Redis::connect to \Redis::pconnect

    opened by prgTW 7
  • Memcache::delete always throws Notice

    Memcache::delete always throws Notice

    There is no possibility to open an issue on doctrine/cache, so I'll open it here.

    I use Doctrine Cache Bundle with Memcache and, when I do this:

    $memcache->save($mykey, 'some-data-here', 3600);
    $result = $memcache->delete($mykey);

    I always get the following Notice:

    PHP Notice: MemcachePool::delete(): Server localhost (tcp 11211, udp 0) failed with: CLIENT_ERROR bad command line format. Usage: delete [noreply]

    If I replace internally in the library this:

    return $this->memcache->delete($id) || ! $this->doContains($id);

    with this:

    return $this->memcache->delete($id, 0) || ! $this->doContains($id);

    Then I no longer get the notice.

    This is quite interesting because, according to PHP documentation:

    It's not recommended to use the timeout parameter.

    Is anyone else experiencing this problem ? Or is it just me ? I suspect most people use memcache when using this library. So how come is it's not reported/fixed by now ?

    opened by SoboLAN 7
The Doctrine Project is the home to several PHP libraries primarily focused on database storage and object mapping.
Doctrine Cache component

Doctrine Cache Cache component extracted from the Doctrine Common project. Documentation This library is deprecated and will no longer receive bug fix

Doctrine 7.6k Jan 3, 2023
A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache tagging and indexing.

Apix Cache, cache-tagging for PHP Apix Cache is a generic and thin cache wrapper with a PSR-6 interface to various caching backends and emphasising ca

Apix 111 Nov 26, 2022
This is a Symfony bundle that lets you you integrate your PSR-6 compliant cache service with the framework

PSR-6 Cache bundle This is a Symfony bundle that lets you you integrate your PSR-6 compliant cache service with the framework. It lets you cache your

null 43 Oct 7, 2021
The place to keep your cache.

Stash - A PHP Caching Library Stash makes it easy to speed up your code by caching the results of expensive functions or code. Certain actions, like d

Tedious Developments 944 Jan 4, 2023
PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

Donate/Support: Documentation: - API reference: Table of contents Installation & usage Adapters

Matthias Mullie 295 Nov 28, 2022
Cache slam defense using a semaphore to prevent dogpile effect.

metaphore PHP cache slam defense using a semaphore to prevent dogpile effect (aka clobbering updates, stampending herd or Slashdot effect). Problem: t

Przemek Sobstel 102 Sep 28, 2022
:zap: Simple Cache Abstraction Layer for PHP

⚡ Simple Cache Class This is a simple Cache Abstraction Layer for PHP >= 7.0 that provides a simple interaction with your cache-server. You can define

Lars Moelleken 27 Dec 8, 2022
LRU Cache implementation in PHP

PHP LRU Cache implementation Intro WTF is a LRU Cache? LRU stands for Least Recently Used. It's a type of cache that usually has a fixed capacity and

Rogério Vicente 61 Jun 23, 2022
Simple cache abstraction layer implementing PSR-16

sabre/cache This repository is a simple abstraction layer for key-value caches. It implements PSR-16. If you need a super-simple way to support PSR-16 48 Sep 9, 2022
PSR-6 cache implementation adapting a given PSR-16 instance

PSR-6 cache implementation adapting PSR-16 This package provides a PSR-6 cache instance when you only have a PSR-16 cache at hand. As PSR-6 is more fe

null 1 Oct 15, 2021
More Than Just a Cache: Redis Data Structures

More Than Just a Cache: Redis Data Structures Redis is a popular key-value store, commonly used as a cache or message broker service. However, it can

Andy Snell 2 Oct 16, 2021
Simple cache

Simple cache

Róbert Kelčák 3 Dec 17, 2022
Elephant - a highly performant PHP Cache Driver for Kirby 3

?? Kirby3 PHP Cache-Driver Elephant - a highly performant PHP Cache Driver for Kirby 3 Commerical Usage Support open source! This plugin is free but i

Bruno Meilick 11 Apr 6, 2022
An improved helper for working with cache

Laravel Cache Installation To get the latest version of Laravel Cache, simply require the project using Composer: $ composer require dragon-code/larav

The Dragon Code 64 Sep 23, 2022
Zend Framework cache backend for MongoDB

Zend_Cache_Backend_Mongo Author: Anton Stöckl About Zend_Cache_Backend_Mongo is a Zend Framework Cache Backend for MongoDB. It supports tags and autoc

Anton Stöckl 12 Feb 19, 2020
PHP local cache

__ ____ _________ ______/ /_ ___ / __ \/ ___/ __ `/ ___/ __ \/ _ \ / /_/ / /__/ /_/ / /__/ / / / __/ / ._

Jayden Lie 48 Sep 9, 2022
A fast, lock-free, shared memory user data cache for PHP

Yac is a shared and lockless memory user data cache for PHP.

Xinchen Hui 815 Dec 18, 2022
A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.

Desarolla2 Cache A simple cache library, implementing the PSR-16 standard using immutable objects. Caching is typically used throughout an applicatito

Daniel González 129 Nov 20, 2022