snakano / propeldatacachebehavior Goto Github PK
View Code? Open in Web Editor NEWA Propel ORM behavior that provide auto data caching to your model.
License: MIT License
A Propel ORM behavior that provide auto data caching to your model.
License: MIT License
Hello!
Can you update to propel2 ?
Thanks :)
Hey SNakano,
I am having the following issue by using your caching behaviour for propel.
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.
To illustrate it better, I will try to show it via the following example.
First of all, I "output" the content of the tables described above.
id |
---|
1 |
2 |
id | consumer_id | item_collection_id |
---|---|---|
1 | 1 | 1 |
2 | 2 | 1 |
id |
---|
1 |
2 |
id | item_collection_id | item_id |
---|---|---|
1 | 1 | 1 |
2 | 1 | 2 |
3 | 2 | 3 |
4 | 2 | 4 |
id |
---|
1 |
2 |
3 |
4 |
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.