Search by

grafite / query-cache

mlantz

A database query caching system with invalidation automation.

Package info

github.com/GrafiteInc/QueryCache

pkg:composer/grafite/query-cache

Statistics

Installs: 772

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.6.0 2026-10-02 02:02 UTC

This package is auto-updated.

Last update: 2026-10-02 02:05:25 UTC


README

Grafite Cache

QueryCache - A general query result caching system for Eloquent models.

Build Status Maintainability Packagist license

QueryCache is a general query result caching system for Eloquent models. It's optimized to be as automated as possible, and can work with Redis and SQLite as caching.

Author(s):

Requirements

  1. PHP 8.2+

Compatibility and Support

Laravel Version Package Tag Supported
^11.x - ^12.x 1.x yes

Installation

Start a new Laravel project:

composer create-project laravel/laravel your-project-name

Then run the following to add Support

composer require "grafite/query-cache"

Documentation

https://documentation.grafite.ca/docs/utilities-querycache

Transactions

Queries run inside a database transaction bypass the cache, since they may see uncommitted data. Cache flushes triggered by model writes inside a transaction are deferred until it commits, and all writes in that transaction share a single flush (a rollback flushes nothing). Set skip_in_transactions (QUERY_CACHE_SKIP_IN_TRANSACTIONS) to false to cache inside transactions, e.g. when your test suite wraps every test in one.

Memoization limit

Repeated identical queries within a request are served from memory. memoize_limit (QUERY_CACHE_MEMOIZE_LIMIT, default 1000) caps how many results are held, evicting the oldest first, so long-running commands stay bounded.

Upgrading

Hashed cache keys now use xxh128 instead of md5, so existing cached queries will miss once after upgrading.

License

Support is open-sourced software licensed under the MIT license

Bug Reporting and Feature Requests

Please add as many details as possible regarding submission of issues and feature requests

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.