Momog
Momog

Reputation: 577

Play framework How to reconcile Stateless with Session & Cache

I'm novice in Play framework,

We said that Play 2 is fully RESTful - there is no Java EE session per connection. However, we can save data in different ways: Session, Flash or Cache!

Does not exist any contradiction?! or I misunderstood things?!

Could someone explain to me?

Upvotes: 3

Views: 1727

Answers (1)

Julien Lafont
Julien Lafont

Reputation: 7877

Session and Flash data are stored on the client itself, in a cookie. They are sent to the server on each request, in fully stateless architecture. If you have an pool with 3 servers, any of them will be able to process the request.

The cache is a temporary data storage. It does not certify that the data you insert will be available when you need them. Consequently, for each cached data, the server must be able to retrieve them, from a database generally.

In this way, the cache doesn't need to be shared between each server, according to the stateless architecture.

Upvotes: 11

Related Questions