Smart (?) Database Cache

后端 未结 6 605
独厮守ぢ
独厮守ぢ 2021-02-04 21:19

I\'ve seen several database cache engines, all of them are pretty dumb (i.e.: keep this query cached for X minutes) and require that you manually delete the whole c

6条回答
  •  暖寄归人
    2021-02-04 22:19

    I can see the beauty in this solution, however, I belive it only works for a very specific set of applications. Scenarios where it is not applicable include:

    • Databases which utilize cascading deletes/updates or any kind of triggers. E.g., your DELETE to table A may cause a DELETE from table B. The regex will never catch this.

    • Accessing the database from points which do not go through you cache invalidation scheme, e.g. crontab scripts etc. If you ever decide to implement replication across machines (introduce read-only slaves), it may also disturb the cache (because it does not go through cache invalidation etc.)

    Even if these scenarios are not realistic for your case it does still answer the question of why frameworks do not implement this kind of cache.

    Regarding if this is worth pursuing, it all depends on your application. Maybe you care to supply more information?

提交回复
热议问题