Skip to content

tbessenreither/multi-level-cache

Repository files navigation

MultiLevelCache Symfony Bundle

A high-performance, multi-level caching system for Symfony applications. This bundle provides a flexible, extensible, and developer-friendly way to combine multiple cache backends (memory, Redis, file, etc.) for optimal speed and reliability.

It has two parts to it.

  1. The Multi Level Cache (MLC)
  2. The Cached Service Generator (CSG)

Of the two parts, the CSG is the intended way of using the MLC. But the MLC itself also has it's use cases and can be used directly without the CSG. Both are documented in sections bellow.

Installation

Install via Composer from GitHub:

  1. Require the package:
    composer require tbessenreither/multi-level-cache

Tip

The following steps can be automated by using Copycat

  1. Enable the Bundle in config/bundles.php:
    Tbessenreither\MultiLevelCache\MultiLevelCacheBundle::class => ['all' => true],
  2. Configure Environment Variables as needed:
    • REDIS_DSN (if using Redis, so basically always)
    • MLC_DISABLE_READ (optional, disables cache reads if it exists at all, no matter the value)
    • MLC_COLLECT_ENHANCED_DATA (optional, enables enhanced data collection but has performance impact)

Basic concept

Its a fast multi level cache consisting, in it's standard configuration, of:

  • a fast In Memory Ring Cache
  • and a second Level Redis Cache

Most notable features

  • Faster and much more memory efficient than the symfony cache (We love it, but we needed something faster)
  • Deduplication of cached objects on read
  • Cache statistics and profiling (Symfony Profiler integration)
  • Beta decay and TTL randomization to prevent stampedes

Cached Service Generator (CSG)

As mentioned above, the main way of using the MLC is via the Cached Service Generator.

Cached Service Generator Documentation

MultiLevelCacheService and MultiLevelCacheFactory

For details on how to use the MLC Service and Factory directly.

MultiLevelCacheService and MultiLevelCacheFactory Documentation

License

MIT

Contributors

Awesome people who contributed to this package

Honorable mentions

thanks for support go to:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors