Coder Social home page Coder Social logo

propeldatacachebehavior's People

Contributors

lbarulski avatar nibsirahsieu avatar snakano avatar staabm avatar stevleibelt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

propeldatacachebehavior's Issues

Propel2

Hello!

Can you update to propel2 ?

Thanks :)

Possible issue with automatically purging the cache for foreign key related tables

Hey SNakano,

I am having the following issue by using your caching behaviour for propel.

Brief Introduction

The case is not easy. It looks like it is not an issue by your component (hopefully).
I am writing this lines to get some feedback and with the hope in my fingers that you could tell me an "hey, you have to do it just this way to fix it easily" ;-).
I am using propel for the whole data "dealing", output as well as manipulation.

Given that we have the following database table structure:

consumer:
id <int>

item_collection_to_consumer:
id <int>
consumer_id <int>
item_collection_id <int>

item_collection:
id <int>

item_to_item_collection
id <int>
item_collection_id <int>
item_id <int>

item:
id <int>

A "consumer" has a unique id.
By using the table "item_collection_to_consumer", we are able to reference zero up to infinity "item_collection"s to a "consumer".
A "item_collection" has a unique id.
By using the table "item_to_item_collection", we are able to reference zero up to infinity "item"s to a "item_collection".
A "item" has a unique id.
Foreign keys are set between the tables and are also configured in the propel schema.xml.

I added the caching behaviour to each of this tables.
I am using redis as caching backend.

When I change the connected "item_collection" for a "consumer", the "item_collection" cache gets purged, but not the "item" cache.

This is pretty bad. When I have to purge all the item cache each time I add/change/delete an entry in "item_collection_to_consumer", the whole caching might be useless.

Example

To illustrate it better, I will try to show it via the following example.

Example Data

First of all, I "output" the content of the tables described above.

Table consumer

id
1
2

Table item_collection_to_consumer

id consumer_id item_collection_id
1 1 1
2 2 1

Table item_collection

id
1
2

Table item_to_item_collection

id item_collection_id item_id
1 1 1
2 1 2
3 2 3
4 2 4

Table item

id
1
2
3
4

Scenario

Now, I will write down the steps, the expected result and the real result.
All the output is based on the assumption that we want to know the data fitting to the consumer with the id "1".

step with description expected result real cache result real database result
Output the connected item_collection 1 1 1
Output the connected items 1, 2 1, 2 1, 2
Update the entry with the id "1" in the table item_collection_to_consumer by setting the value for the column "item_collection_to_consumer" to "2" - - -
Output the connected item_collection 2 2 2
Output the connected items 3, 4 1, 2 3, 4

As you see, the cache and the database differs.
All I can assume is the following idea. While the cached data for table "item_collection_to_consumer" is purged, the cache data for the items is not purged. Thats a fact since I can see and read this in the redis cache.

Final Words

The big question, whole can we trigger the purging of the cache and ideally without doing anything on the application front.
Do you have an advice?
Do you experienced that kind of error already?
Do you need more information?

Kind regards,
stev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.