PHPackages                             rickysu/cacheable-behavior-bundle - 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. rickysu/cacheable-behavior-bundle

ActiveLibrary[Caching](/categories/caching)

rickysu/cacheable-behavior-bundle
=================================

Provide a propel1 smart cache behavior bundle for symfony 2

v1.0.2(13y ago)445MITPHPPHP &gt;=5.3.3

Since Nov 26Pushed 13y ago1 watchersCompare

[ Source](https://github.com/RickySu/cacheable-behavior-bundle)[ Packagist](https://packagist.org/packages/rickysu/cacheable-behavior-bundle)[ Docs](https://github.com/RickySu/cacheable-behavior-bundle)[ RSS](/packages/rickysu-cacheable-behavior-bundle/feed)WikiDiscussions master Synced 1mo ago

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

Propel Cacheable Behavior Bundle
================================

[](#propel-cacheable-behavior-bundle)

[![Build Status](https://camo.githubusercontent.com/074c6142b313ad0cfdac057976bd826d8808bcc28849bd701d94f5b7724d2964/68747470733a2f2f6170692e7472617669732d63692e6f72672f7265706f7369746f726965732f5269636b7953752f636163686561626c652d6265686176696f722d62756e646c652e706e67)](https://api.travis-ci.org/repositories/RickySu/cacheable-behavior-bundle.png%5D)

Introduction
------------

[](#introduction)

This is a symfony2 bundle for propel1 and provides a smart relation cache.

Features
--------

[](#features)

- primary key and unique index query cache.
- one to one relation cache.
- one to many relation cache.
- many to many relation cache.
- auto detect single or composite key.

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

[](#requirements)

- PHP 5.3.3 above
- rickysu/tagcache 0.1 above

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

[](#installation)

editing the composer.json file in the root project.

### Editing the composer.json under require: {} section add

[](#editing-the-composerjson-under-require--section-add)

```
"rickysu/cacheable-behavior-bundle": "0.1.*",

```

### Install Bundle With Composer :

[](#install-bundle-with-composer-)

```
php composer.phar install

```

How to Use
----------

[](#how-to-use)

### setup config

[](#setup-config)

app/config.yml

```
propel:
    path:       "%kernel.root_dir%/../vendor/propel"
    phing_path: "%kernel.root_dir%/../vendor/phing"
    logging:    %kernel.debug%
    dbal:
        driver:               %database_driver%
        user:                 %database_user%
        password:             %database_password%
        dsn:                  %database_driver%:host=%database_host%;dbname=%database_name%;charset=UTF8
    behaviors:
        cacheable:           RickySu\CacheableBehaviorBundle\Behavior\CacheableBehavior
```

### add cacheable behavior in your schema.xml

[](#add-cacheable-behavior-in-your-schemaxml)

### retrieve data with primary key or unique index

[](#retrieve-data-with-primary-key-or-unique-index)

```

```

```
// filter by id =1 and build cache
$Member=MemberPeer::retrieveByPk(1);
$Member=MemberQuery::create()->findPk(1);

//filter by username , email and build cache
$Member=MemberPeer::retrieveByUsernameEmail('username','somebody@foo.com');
$Member=MemberQuery::create()
  ->filterByUsername('username')
  ->filterByEmail('somebody@foo.com')
  ->findOne();

//delete cache when save or delete
$Member->save();
$Member->delete();
```

### retrieve data with one to one relation

[](#retrieve-data-with-one-to-one-relation)

```

```

### retrieve data with one to many relation

[](#retrieve-data-with-one-to-many-relation)

```

```

### retrieve data with one to many relation

[](#retrieve-data-with-one-to-many-relation-1)

```

```

TODO
----

[](#todo)

clear cache when change relation mapping.

```
//set $Article belonds to $Category1
$Article->setCategory($Category1);
$Article->save();

//set $Article belonds to $Category2
$Article->setCategory($Category2);
$Article->save();

//we need to clear $Category1 and $Category2 reference cache.
```

Note
----

[](#note)

If your want use this behavior without symfony2 , please folow this [demo](https://github.com/RickySu/demo-cacheable-behavior-bundle).

LICENSE
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~66 days

Total

3

Last Release

4788d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8440573e58d15491de4e757877d06ef061da110763cd2f035ba8344b8314b10d?d=identicon)[rickysu](/maintainers/rickysu)

---

Top Contributors

[![RickySu](https://avatars.githubusercontent.com/u/248728?v=4)](https://github.com/RickySu "RickySu (45 commits)")

---

Tags

cachepropelrickysu

### Embed Badge

![Health badge](/badges/rickysu-cacheable-behavior-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/rickysu-cacheable-behavior-bundle/health.svg)](https://phpackages.com/packages/rickysu-cacheable-behavior-bundle)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k686.9M1.3k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/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.

2512.2M6](/packages/beste-in-memory-cache)[anahkiasen/flatten

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

33313.0k](/packages/anahkiasen-flatten)[snakano/propel-data-cache-behavior

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

2043.8k](/packages/snakano-propel-data-cache-behavior)

PHPackages © 2026

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