amanteaux / jooq-cache

A cache layer on top of jOOQ
7 stars 0 forks source link

Manage transaction #11

Open amanteaux opened 10 years ago

amanteaux commented 10 years ago

Transaction are currently not handled: no data are cached during a transaction and no cache are cleaned during a transaction.

A transaction system should be provided which will replay all requests incidence on the cache once the transaction has been committed. For example if a transaction contains 2 queries select a from b and delete from c, once the transaction is committed, the query result select a from b should be cached and any query referencing the c table should be cleaned.

What could be done to implements this behavior is to have a custom connexion that would contain a scenario variable. This scenario would then be filled by each statement in the transaction. At the commit of the transaction, the scenario will be played.

amanteaux commented 10 years ago

Actually, the select queries should not produce a cache entry since the database may change before the transaction is finished. For example:

  1. transaction is started
  2. transaction: select a from b
  3. outside transaction delete from b
  4. transaction is finished

=> the b table cache should be empty