How exactly does one integrate a cache in his project (spring + hibernate) -


i have project supports 10's of concurrent users.

my project spring + hibernate project mysql db.

i keep cache of entities (i.e. player)

i have couple of questions:

1) how work cache (when have one) ? if have persist player change cache , persist hibernate?

2) spring support cache mechanism ? if how 1 work it?

hibernate

hibernate has second level cache. start work need to:

  • choose cache provider (ehcache, infinispan, ...).
  • configure cache region (and choose corresponding strategy depending on situation)
  • enable cache entity

it declarative, of time not need change application code.

spring

spring has cache abstraction. there common steps (choose chache provider, configure cache regions). more general pourpose cache, not related hibernate entities , transactions. must more work (annotate necessary methods annotations).

in general if player class hibernate entity better go hibernate cache. may not true if have special demands.

hope helps.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -