PHPackages                             kodus/db-cache - 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. kodus/db-cache

ActiveLibrary[Caching](/categories/caching)

kodus/db-cache
==============

PSR-16 cache-implementation for SQL databases

2.1.0(1y ago)030.6k↓39.4%1[1 issues](https://github.com/kodus/db-cache/issues)MITPHPPHP &gt;= 8.0CI failing

Since May 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/kodus/db-cache)[ Packagist](https://packagist.org/packages/kodus/db-cache)[ RSS](/packages/kodus-db-cache/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

`kodus/db-cache`
================

[](#kodusdb-cache)

[PSR-16](https://www.php-fig.org/psr/psr-16/) cache implementation for PostgreSQL (9.5+) and MySQL.

Tuned for fast, precise SQL - all operations (including multiple get/set/delete) are fully transactional and complete in a single round-trip.

No dependencies beyond the PSR-16 interface.

[![PHP Version](https://camo.githubusercontent.com/487804500a039aee09e5d93e41b745b4cd68dcc0fdf801e67d26d30b93f83358/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d626c75652e737667)](https://packagist.org/packages/kodus/db-cache)[![Build Status](https://camo.githubusercontent.com/81eaa24d27de919c6ecf056c73d02a1bd865c78e9727dcebb89522471fc0aa50/68747470733a2f2f7472617669732d63692e6f72672f6b6f6475732f64622d63616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kodus/db-cache)[![Code Coverage](https://camo.githubusercontent.com/6ef7bc684c2179a7bde6e345499f068a535d5f6d41dfc57ac3fce83a542f0f13/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b6f6475732f64622d63616368652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kodus/db-cache/?branch=master)[![Code Quality](https://camo.githubusercontent.com/6f8df119744b5867124128c3b9ad67854aba719bed8e5a31f4e32d65fad6ecbb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b6f6475732f64622d63616368652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kodus/db-cache/?branch=master)

Installation
------------

[](#installation)

Install via [Composer](https://getcomposer.org/):

```
composer require kodus/db-cache

```

Usage
-----

[](#usage)

The constructor will automatically detect PostgreSQL or MySQL and use the appropriate adapter - all you need to do is open a `PDO` connection and specify a table-name and default TTL:

```
$pdo = new PDO("pgsql:host=localhost;port=5432;dbname=test", "root", "root");

$cache = new DatabaseCache($pdo, "my_cache_table", 24*60*60);
```

Tables are automatically created with the first database operation.

Please refer to [PSR-16 documentation](https://www.php-fig.org/psr/psr-16/) for general usage.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 70.5% 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 ~687 days

Total

4

Last Release

536d ago

Major Versions

1.1.0 → 2.0.02022-08-24

PHP version history (2 changes)1.0.0PHP &gt;= 7.2

1.1.0PHP &gt;= 8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5709900?v=4)[Thomas Nordahl Pedersen](/maintainers/thomasnordahl-dk)[@thomasnordahl-dk](https://github.com/thomasnordahl-dk)

![](https://avatars.githubusercontent.com/u/13201214?v=4)[Bo Andersen](/maintainers/boan-jfm)[@boan-jfm](https://github.com/boan-jfm)

![](https://avatars.githubusercontent.com/u/32329468?v=4)[Jesper Østergaard Jensen](/maintainers/JyskFynskeMedierJoej)[@JyskFynskeMedierJoej](https://github.com/JyskFynskeMedierJoej)

![](https://avatars.githubusercontent.com/u/25659854?v=4)[Michelle Fich](/maintainers/mifich)[@mifich](https://github.com/mifich)

---

Top Contributors

[![JyskFynskeMedierJoej](https://avatars.githubusercontent.com/u/32329468?v=4)](https://github.com/JyskFynskeMedierJoej "JyskFynskeMedierJoej (31 commits)")[![mindplay-dk](https://avatars.githubusercontent.com/u/103348?v=4)](https://github.com/mindplay-dk "mindplay-dk (11 commits)")[![vortrixs](https://avatars.githubusercontent.com/u/15426116?v=4)](https://github.com/vortrixs "vortrixs (2 commits)")

---

Tags

cachemysqlphppostgresqlpsr-16

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kodus-db-cache/health.svg)

```
[![Health](https://phpackages.com/badges/kodus-db-cache/health.svg)](https://phpackages.com/packages/kodus-db-cache)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

378604.0k104](/packages/flow-php-etl)

PHPackages © 2026

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