Doctrine Cache component

Related tags

Caching cache
Overview

Doctrine Cache

Build Status Code Coverage

Latest Stable Version Total Downloads

Cache component extracted from the Doctrine Common project. Documentation

This library is deprecated and will no longer receive bug fixes from the Doctrine Project. Please use a different cache library, preferably PSR-6 or PSR-16 instead.

Comments
  • File cache names are too long. Checks limiting it to 255 do not actually work properly in all cases.

    File cache names are too long. Checks limiting it to 255 do not actually work properly in all cases.

    First of all, there was this issue posted for Symfony here: https://github.com/symfony/symfony/issues/19363 . I encountered the same thing and spent a lot of time investigating it and came up to this: When using FileCache filenames sometimes are longer, than supported. I am using docker containers on vagrant with VBox linked shared folders. There is a limit for a FILE_NAME of 255 characters. I tried renaming some of the long filenames inside cache directories and the error switched to another folder: /var/www/html/var/cache/de~/annotations/fd -> var/www/html/var/cache/de~/annotations/44 for example. So it looks like command is able to process the first folder, but then fails on the second one, as there is also a very long filename (256 characters including extension, which should be 255).

    I am using docker containers on vagrant with VirtualBox and I suspect that the vboxsf might have some FILE_NAME or PATH_NAME limitations and those are 255 and 4096 respectively.

    Then I tried to reduce filenames from 256 chars and went to Doctrine\Common\Cache\FilesystemCache and changed extension from .doctrinecache.data to .doctrine.data and everything worked, I was able to clear the cache after clearing the previous one manually (it still had long files).

    It led me to suspect, that the problem lies within Doctrine\Common\Cache\FileCache, getFilename() does not work properly and sometimes has wrong behaviour. I think this issue is also connected to #174 .

    IMPORTANT: Issue persists only for Symfony dev environment and works fine for prod.

    opened by yurii-mysak 27
  • FilesystemCache should not use that many directories

    FilesystemCache should not use that many directories

    ... in order to have a manageable amount of items per directory. See this blog post.

    When splitting the hash into four pieces, each containing 16 chars, with each 16 possible values this can lead to 16^16 (1.84467441e19) folders at each level. This might lead to an amount which goes far beyond filesystem limits. Even if a filesystem could handle that many items/folders, "stat operations such as listing files, following paths, or checking for the existence of a file" will be super slow!

    Bug 
    opened by OleMchls 24
  • Reduced number of subdirectories generated by FileCache

    Reduced number of subdirectories generated by FileCache

    Currently FileCache implementation generates 32 subdirectories for each cache entry. This is inefficient (FS), useless (every single file is going to be stored in its own subdirectory) and leads to quite hard to debug/detect bugs caused by max filepath length (260 chars on Windows).

    Bug Duplicate 
    opened by Crozin 21
  • Drop RiakCache support

    Drop RiakCache support

    Breaking change, but as per #323 this seems a reasonable way forward if released as a semver breaking change?

    The code isn't valid on PHP 7.2+, which is supported, meaning that PHP 7.1 is the only version of PHP that is supported upstream that would work with the code

    It's pretty evident on the various forks that have been made, no one really seems that interested in maintaining the support properly

    Bug 
    opened by reedy 18
  • fix file cache naming under windows surpassing MAX_PATH

    fix file cache naming under windows surpassing MAX_PATH

    I realised that doctrine annotation cache (which uses long cache keys) is failing in symfony under windows. Its because in Windows the whole path is limited to 260 chars. See http://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-windows

    Also fixed travis tests with apcu due to new releases of apcu for php 5 and 7.

    Bug 
    opened by Tobion 18
  • Allowing more extension of the Cache Provider

    Allowing more extension of the Cache Provider

    https://github.com/doctrine/common/pull/196 https://github.com/doctrine/common/commit/b71b6b8160033f451bde765c4bb147d3dabf74d3

    This was in before, not sure what happened to it. Would be nice to have again, for the same reasons the other guy had

    opened by aequasi 17
  • 1.12.1 and PHP7 breaking compatibility

    1.12.1 and PHP7 breaking compatibility

    Hi,

    I just noticed something strange. Based on https://github.com/doctrine/cache/blob/1.12.1/composer.json, it seems that 1.12.1 should be ~7.1 and 8.0 compatible. But in this version, we can also see this: https://github.com/doctrine/cache/blob/1.12.1/lib/Doctrine/Common/Cache/Psr6/TypedCacheItem.php#L24

        public function __construct(
            private string $key,
            private mixed $value,
            private bool $isHit,
        ) {
        }
    

    But if I'm right, and based on PHP website, this is a PHP8 feature.

    Can you please confirm that 1.12.* is not PHP7 compatible please?

    Thank you.

    opened by Tithugues 16
  • PSR-6 implementation

    PSR-6 implementation

    The adapter added with this PR allows us to use Doctrine Cache as a PSR-6 implementation. This will allow us to decouple various Doctrine libraries from Doctrine cache.

    #SymfonyHackday

    opened by derrabus 16
  • Sunsetting doctrine/cache

    Sunsetting doctrine/cache

    Hello,

    with many great PSR-6 and PSR-16 implementations available, it is no longer feasible for the Doctrine Project to keep maintaining a separate cache library. We have thus decided to sunset doctrine/cache and prepare its removal process. As many libraries, including our own, depend on this package, this process will be gradual.

    Version 1.11 will deprecate all classes and interfaces provided, but the library will continue working as expected. We will provide the same level of support as we have so far. We will also release version 2.0, which will drop all cache implementations and only retain the abstract CacheProvider class as well as the interfaces. 2.0 is designed as a lightweight package that compatibility libraries (e.g. symfony/cache which provides a bridge to PSR interfaces) can depend on.

    If your package currently depends on any doctrine/cache version, here's what you should do:

    • if your package uses any cache implementation, you should find a suitable alternative and replace usages.
    • if your package doesn't use any cache implementations but needs the interfaces, you should amend the current version constraint to allow installing doctrine/cache 2.0, e.g. "doctrine/cache": "^1.10 || ^2.0"
    • if your package doesn't use any classes from doctrine/cache at all, drop the package requirement from composer.json.

    If you would like to take over maintenance of the package, please reach out to us.

    BC Break 
    opened by alcaeus 15
  • Alias `Riak\Object as RiakObject` to prevent errors in PHP 7.2

    Alias `Riak\Object as RiakObject` to prevent errors in PHP 7.2

    As of PHP 7.2 object is a reserved word. Therefore, this line: https://github.com/doctrine/cache/blob/master/lib/Doctrine/Common/Cache/RiakCache.php#L8 triggers a PHP error in 7.2. This PR attempts to solve this issue by aliasing the import.

    Issue: https://github.com/doctrine/cache/issues/292

    Bug 
    opened by pavlepredic 15
  • Call to undefined function Doctrine\Common\Cache\apcu_fetch()

    Call to undefined function Doctrine\Common\Cache\apcu_fetch()

    When I clear the cache using php bin/console doctrine:cache:clear-metadata --env=prod;or php bin/console doctrine:cache:clear-query --env=prod; I receive the error Call to undefined function Doctrine\Common\Cache\apcu_fetch().

    The function apcu_fetch()is called from https://github.com/doctrine/cache/blob/master/lib/Doctrine/Common/Cache/ApcuCache.php but it doesn't exist in the file, neither in the project... Do I miss something ?

    Invalid Question 
    opened by LaurentMarquet 14
  • mark doctrine/cache as abandoned on packagist?

    mark doctrine/cache as abandoned on packagist?

    the packagist information for doctrine/cache still looks like all is fine: https://packagist.org/packages/doctrine/cache

    i suggest to change the description to explain the status, and also mark the package as abandoned so that composer install spits out a warning that users should move on to something else.

    opened by dbu 1
Releases(2.2.0)
Owner
Doctrine
The Doctrine Project is the home to several PHP libraries primarily focused on database storage and object mapping.
Doctrine
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
The cache component provides a Promise-based CacheInterface and an in-memory ArrayCache implementation of that

Cache Async, Promise-based cache interface for ReactPHP. The cache component provides a Promise-based CacheInterface and an in-memory ArrayCache imple

ReactPHP 330 Dec 6, 2022
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: https://www.scrapbook.cash - API reference: https://docs.scrapbook.cash 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

sabre.io 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
PHP Cache Duration

PHP Cache Duration Introduction A readable and fluent way to generate PHP cache time. Built and written by Ajimoti Ibukun Quick Samples Instead of thi

null 27 Nov 8, 2022