PHPackages                             snakano/propel-data-cache-behavior - 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. snakano/propel-data-cache-behavior

ActiveLibrary[Caching](/categories/caching)

snakano/propel-data-cache-behavior
==================================

A Propel ORM behavior that provide auto data caching to your model.

1.2.2(10y ago)2044.4k↑39.6%12[1 issues](https://github.com/SNakano/PropelDataCacheBehavior/issues)[1 PRs](https://github.com/SNakano/PropelDataCacheBehavior/pulls)MITPHPPHP &gt;=5.3.3

Since May 18Pushed 10y ago5 watchersCompare

[ Source](https://github.com/SNakano/PropelDataCacheBehavior)[ Packagist](https://packagist.org/packages/snakano/propel-data-cache-behavior)[ RSS](/packages/snakano-propel-data-cache-behavior/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (9)Used By (0)

PropelDataCacheBehavior
=======================

[](#propeldatacachebehavior)

[![Build Status](https://camo.githubusercontent.com/722da003928b68589a225bf4763a5017500c24655368c745d44a301a0da81491/68747470733a2f2f7472617669732d63692e6f72672f534e616b616e6f2f50726f70656c4461746143616368654265686176696f722e706e67)](https://travis-ci.org/SNakano/PropelDataCacheBehavior)[![Latest Stable Version](https://camo.githubusercontent.com/eba66c62b3c0185b2bdf0b8e5680d62f53a52ef84b197bb5f3a2b483c7d39a52/68747470733a2f2f706f7365722e707567782e6f72672f736e616b616e6f2f70726f70656c2d646174612d63616368652d6265686176696f722f762f737461626c652e706e67)](https://packagist.org/packages/snakano/propel-data-cache-behavior)[![Total Downloads](https://camo.githubusercontent.com/0cfeb7c224cf386815c0a77c73fe81ca3d31c291483985dc7b5497cd0c03c43f/68747470733a2f2f706f7365722e707567782e6f72672f736e616b616e6f2f70726f70656c2d646174612d63616368652d6265686176696f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/snakano/propel-data-cache-behavior)

A Propel ORM behavior that provide auto data caching to your model.

- support caching system APC, memcached and Redis (via [DominoCacheStore](https://github.com/SNakano/CacheStore))
- auto caching and auto flush.

#### What's the difference Query Cache Behavior

[](#whats-the-difference-query-cache-behavior)

[Query Cache Behavior](http://propelorm.org/behaviors/query-cache.html) is caching transformation of a Query object (caching SQL code).
This Behavior is caching the results of database. (result data cache)

Requirements
------------

[](#requirements)

- Propel &gt;= 1.6.0
- [DominoCacheStore](https://github.com/SNakano/CacheStore)

Install
-------

[](#install)

### Composer

[](#composer)

Add a dependency on `snakano/propel-data-cache-behavior` to your project's `composer.json` file.

```
{
    "require": {
        "snakano/propel-data-cache-behavior": "1.*"
    }
}
```

Then, add the following configuration to your `build.properties` or `propel.ini` file:

```
propel.behavior.data_cache.class = lib.vendor.snakano.propel-data-cache-behavior.src.DataCacheBehavior
```

Configuration
-------------

[](#configuration)

### schema.xml

[](#schemaxml)

```

```

### if use memcached.

[](#if-use-memcached)

Add the following configuration code to your project bootstraping file.

```
// configure memcached setting.
Domino\CacheStore\Factory::setOption(
    array(
        'storage'     => 'memcached',
        'prefix'      => 'domino_test',
        'default_ttl' => 360,
        'servers'     => array(
            array('server1', 11211, 20),
            array('server2', 11211, 80)
        )
    )
);
```

### Basic usage

[](#basic-usage)

```
$title = 'War And Peace';
BookQuery::create()
    ->filterByTitle($title)
    ->findOne(); // from Database

BookQuery::create()
    ->filterByTitle($title)
    ->findOne(); // from caching system
```

### Disable cache

[](#disable-cache)

```
$title = 'Anna Karenina';
BookQuery::create()
    ->setCacheDisable()  // disable cache
    ->filterByTitle($title)
    ->findOne();
```

- setCacheEnable()
- setCacheDisable()
- isCacheEnable()
- setLifetime($ttl)

### When cache delete?

[](#when-cache-delete)

```
$book = new Book;
$book->setId(1);
$book->setTitle("War And Peace");
$book->save();  // purge cache.
```

- expire cache lifetime.
- call `save()` method.
- call `delete()` method.
- call `BookPeer::doDeleteAll()` method.
- call `BookPeer::purgeCache()` method.

### Manually delete cache.

[](#manually-delete-cache)

```
$title = 'War And Peace';
$query = BookQuery::create();
$book  = $query->filterByTitle($title)->findOne();
$cacheKey = $query->getCacheKey(); // get cache key.

BookPeer::cacheDelete($cacheKey);  // delete cache by key.
```

License
-------

[](#license)

MIT License

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 79.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 ~138 days

Recently: every ~197 days

Total

8

Last Release

3825d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e50b040bf4e8f07435a2253b9b6fcf3b4c38dba89d7f126b0f50271d2125720c?d=identicon)[SNakano](/maintainers/SNakano)

---

Top Contributors

[![SNakano](https://avatars.githubusercontent.com/u/1312539?v=4)](https://github.com/SNakano "SNakano (35 commits)")[![lbarulski](https://avatars.githubusercontent.com/u/2803144?v=4)](https://github.com/lbarulski "lbarulski (3 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (3 commits)")[![nibsirahsieu](https://avatars.githubusercontent.com/u/208039?v=4)](https://github.com/nibsirahsieu "nibsirahsieu (2 commits)")[![stevleibelt](https://avatars.githubusercontent.com/u/2287220?v=4)](https://github.com/stevleibelt "stevleibelt (1 commits)")

---

Tags

cachephppropelcacheBehaviorpropel

### Embed Badge

![Health badge](/badges/snakano-propel-data-cache-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/snakano-propel-data-cache-behavior/health.svg)](https://phpackages.com/packages/snakano-propel-data-cache-behavior)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k772.9M2.7k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k726.4M1.7k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

445131.2M46](/packages/react-cache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2515.9M12](/packages/beste-in-memory-cache)[fastd/fastd

A High Performance API Framework By Swoole Extension

42015.5k18](/packages/fastd-fastd)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33313.0k](/packages/anahkiasen-flatten)

PHPackages © 2026

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