PHPackages                             lustmored/flysystem-v2-simple-cache-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. lustmored/flysystem-v2-simple-cache-adapter

ActiveLibrary[Caching](/categories/caching)

lustmored/flysystem-v2-simple-cache-adapter
===========================================

Simple flysystem PSR cache adapter decorator.

0.3.0(4y ago)16118.7k↓17.4%61MITPHPPHP &gt;=7.2

Since Nov 27Pushed 4y ago4 watchersCompare

[ Source](https://github.com/Lustmored/flysystem-v2-simple-cache-adapter)[ Packagist](https://packagist.org/packages/lustmored/flysystem-v2-simple-cache-adapter)[ RSS](/packages/lustmored-flysystem-v2-simple-cache-adapter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (11)Used By (1)

flysystem-v2-simple-cache-adapter
=================================

[](#flysystem-v2-simple-cache-adapter)

[![Build Status](https://camo.githubusercontent.com/31ba1d6147a8ff49ecee3cbf353538e847908a2f5c9661a7070e4768c5a3466f/68747470733a2f2f7472617669732d63692e636f6d2f4c7573746d6f7265642f666c7973797374656d2d76322d73696d706c652d63616368652d616461707465722e7376673f6272616e63683d6d61696e)](https://travis-ci.com/Lustmored/flysystem-v2-simple-cache-adapter)

Simple cache decorator for Flysystem v2 Adapters.

Installation
============

[](#installation)

`composer require lustmored/flysystem-v2-simple-cache-adapter`

Usage
=====

[](#usage)

CacheAdapter takes simply 2 parameters:

- `$adapter` - Filesystem adapter to be decorated
- `$cachePool` - PSR-6 compliant cache pool object

Example configuration in Symfony with `flysystem-bundle` (thanks to @weaverryan for summarizing things up):

\[OPTIONAL\] Create Cache pool to use:

```
# config/packages/cache.yaml
framework:
    cache:
        pools:
            cache.flysystem.psr6:
                adapter: cache.app
```

Configure service. Here `@flysystem.adapter.uploads_adapter` is Flysystem adapter (based on `flysystem-bundle` configuration for `uploads_adapter` storage):

```
# config/services.yaml
services:
    # ...

    flysystem.cache.adapter:
        class: Lustmored\Flysystem\Cache\CacheAdapter
        arguments:
            $adapter: '@flysystem.adapter.uploads_adapter'
            $cachePool: '@cache.flysystem.psr6'
```

Finally, wire it up into `flysytem-bundle`:

```
# config/packages/flysystem.yaml
flysystem:
    storages:
        # ... your other storages

        cached_public_uploads_storage:
            # point this at your service id from above
            adapter: 'flysystem.cache.adapter'
```

Architecture
============

[](#architecture)

Please note this library is in early stages and cache format or functionality may change. I've created it for my own project and needs.

Idea is from `flysystem-cached-driver`, but cache logic is rethought. Instead of one big cache (that is killing memory when you have tens of thousands of files) it stores items on per-file basis.

Therefore, at least for now, there is no gain on `listContents` method, yet potential huge gains for `fileExists` and metadata-related methods (especially on network/cloud filesystems, like S3).

Performance
===========

[](#performance)

Benchmarks run with Redis in Docker (via provided `docker-compose.yml`). S3 benchmarks require setting environment vars (for example by providing `.env.bench.local`). Cached benchmarks have cache warmed by calling `listContents`.

Below are reports from single benchmark run on devel machine as of 0.0.4. They show that caching metadata with the local adapter makes no sense, while using it for S3 brings potential huge benefits when querying existing files. `fileExists` benchmark randomly queries files with about 50% of them existing.

benchmarksubjectsetrevsitermem\_peaktime\_revcomp\_z\_valuecomp\_deviationLocalBenchbenchCopyAndDelete0102,695,904b9,757.000μs0.00σ0.00%LocalBenchbenchListContents0102,695,904b1,925.000μs0.00σ0.00%LocalBenchbenchMove0102,695,896b13,083.000μs0.00σ0.00%LocalBenchbenchRandomFileExists0102,695,904b1,893.000μs0.00σ0.00%LocalBenchbenchRandomFileSize0102,695,904b2,216.000μs0.00σ0.00%LocalBenchbenchRandomLastModified0102,695,904b3,689.000μs0.00σ0.00%LocalBenchbenchRandomMimeType0103,609,408b28,681.000μs0.00σ0.00%LocalBenchbenchRandomRead0102,695,896b3,490.000μs0.00σ0.00%LocalBenchbenchRandomSetVisibility0102,695,912b2,958.000μs0.00σ0.00%LocalBenchbenchRandomVisibility0102,695,904b2,866.000μs0.00σ0.00%LocalBenchbenchRandomWrite0102,695,904b11,619.000μs0.00σ0.00%AwsBenchbenchCopyAndDelete01014,163,224b25,638,767.000μs0.00σ0.00%AwsBenchbenchListContents01010,141,384b394,385.000μs0.00σ0.00%AwsBenchbenchMove01017,951,440b54,856,950.000μs0.00σ0.00%AwsBenchbenchRandomFileExists01011,294,928b12,921,070.000μs0.00σ0.00%AwsBenchbenchRandomFileSize01011,153,896b5,655,586.000μs0.00σ0.00%AwsBenchbenchRandomLastModified01011,153,896b5,901,532.000μs0.00σ0.00%AwsBenchbenchRandomMimeType01011,153,896b6,200,496.000μs0.00σ0.00%AwsBenchbenchRandomRead01011,098,640b5,975,538.000μs0.00σ0.00%AwsBenchbenchRandomSetVisibility01011,279,472b4,980,556.000μs0.00σ0.00%AwsBenchbenchRandomVisibility01011,086,464b7,118,953.000μs0.00σ0.00%AwsBenchbenchRandomWrite01011,223,672b6,863,634.000μs0.00σ0.00%CachedLocalBenchbenchCopyAndDelete0103,114,992b66,819.000μs0.00σ0.00%CachedLocalBenchbenchListContents0103,114,944b29,511.000μs0.00σ0.00%CachedLocalBenchbenchMove0103,114,984b120,609.000μs0.00σ0.00%CachedLocalBenchbenchRandomFileExists0103,114,992b17,195.000μs0.00σ0.00%CachedLocalBenchbenchRandomFileSize0103,114,992b22,410.000μs0.00σ0.00%CachedLocalBenchbenchRandomLastModified0103,114,992b13,735.000μs0.00σ0.00%CachedLocalBenchbenchRandomMimeType0104,079,264b74,065.000μs0.00σ0.00%CachedLocalBenchbenchRandomRead0103,114,984b16,104.000μs0.00σ0.00%CachedLocalBenchbenchRandomSetVisibility0103,115,000b36,545.000μs0.00σ0.00%CachedLocalBenchbenchRandomVisibility0103,114,992b19,188.000μs0.00σ0.00%CachedLocalBenchbenchRandomWrite0103,114,992b30,787.000μs0.00σ0.00%CachedAwsBenchbenchCopyAndDelete01014,701,496b25,902,601.000μs0.00σ0.00%CachedAwsBenchbenchListContents01010,741,088b145,838.000μs0.00σ0.00%CachedAwsBenchbenchMove01018,489,776b53,389,348.000μs0.00σ0.00%CachedAwsBenchbenchRandomFileExists01011,360,328b9,891,007.000μs0.00σ0.00%CachedAwsBenchbenchRandomFileSize01010,494,808b17,082.000μs0.00σ0.00%CachedAwsBenchbenchRandomLastModified01010,494,808b16,780.000μs0.00σ0.00%CachedAwsBenchbenchRandomMimeType01011,362,408b4,023,242.000μs0.00σ0.00%CachedAwsBenchbenchRandomRead01011,655,608b6,180,574.000μs0.00σ0.00%CachedAwsBenchbenchRandomSetVisibility01011,930,632b5,753,747.000μs0.00σ0.00%CachedAwsBenchbenchRandomVisibility01011,319,584b3,708,345.000μs0.00σ0.00%CachedAwsBenchbenchRandomWrite01011,791,352b6,785,903.000μs0.00σ0.00%--------------------------------------------------------------------------------------------------------------------------

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~46 days

Recently: every ~103 days

Total

10

Last Release

1582d ago

PHP version history (2 changes)0.0.1PHP ^7.4|^8.0

0.1.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/426c03afba39369e2dba2d3c2713c0831f26f02c405b8cfa23f0bf41b9ec2a91?d=identicon)[Lustmored](/maintainers/Lustmored)

---

Top Contributors

[![Lustmored](https://avatars.githubusercontent.com/u/2358046?v=4)](https://github.com/Lustmored "Lustmored (12 commits)")

---

Tags

cacheflysystempsr

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/lustmored-flysystem-v2-simple-cache-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/lustmored-flysystem-v2-simple-cache-adapter/health.svg)](https://phpackages.com/packages/lustmored-flysystem-v2-simple-cache-adapter)
```

###  Alternatives

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k348.9M2.5k](/packages/symfony-cache)[symfony/cache-contracts

Generic abstractions related to caching

2.4k308.9M198](/packages/symfony-cache-contracts)[league/flysystem-cached-adapter

An adapter decorator to enable meta-data caching.

35426.9M119](/packages/league-flysystem-cached-adapter)[cache/cache

Library of all the php-cache adapters

2712.7M22](/packages/cache-cache)[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[cache/tag-interop

Framework interoperable interfaces for tags

10525.0M12](/packages/cache-tag-interop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
