Class BlueMindSessionCache
Why a session is kept at all. Opening a session per call costs a login, the call and a logout — three requests for one answer, measured at 0.2 to 0.4 s each against the demo rig. With the technical-account provider it is worse than three, because producing the account's credentials is itself two BlueMind calls — the technical login, then the sudo.
Why here, and not in a store — and why this is a class, not a port. A session key is a live credential that acts as a user, with a lifetime in minutes.
- Not the database. Persisting it would mean encrypting it under the instance codec key, migrating it and cleaning it up, for a value that expires long before any of that matters.
- Not the platform's cache layer. Anything registered with the
Kernel's
CacheServiceis reachable by name from any other code in the container, and a cache is a thing a deployment may one day replicate. A credential that authenticates one person's mailbox must not travel between nodes, so it lives in a field of this object and nowhere else. That is also why the client offers no pluggable store for it. - Node-local. Each node mints its own session per account, which costs one login; losing them all on a restart costs one login each. That is the whole price of not replicating a credential.
The key is who the session acts as, field by field
(BlueMindSessionKey). Two users cannot land on one entry, and one
user cannot land on an entry minted for another mailbox.
Bounded in both directions. An entry lives ttlSeconds
seconds (for the calendar plugins,
exo.agenda.caldav.bluemind.session.ttlSeconds) and there are at most
maxAccounts of them (…session.maxAccounts); beyond that the
session is used but not kept, so the map cannot grow with the user base of
an instance nobody sized it for. A session this store declines to keep is
closed by the call that opened it — holds(org.exoplatform.bluemind.client.model.BlueMindSessionKey, org.exoplatform.bluemind.client.model.BlueMindLogin) is how that call finds
out — because nobody will ever present it again.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of accounts kept per node.static final intDefault entry lifetime, in seconds. -
Constructor Summary
ConstructorsConstructorDescriptionBlueMindSessionCache(int ttlSeconds, int maxAccounts) A cache on the system clock. -
Method Summary
Modifier and TypeMethodDescriptionstatic BlueMindSessionCacheunpooled()A cache that keeps nothing: every call opens its own session and closes it, as a call that cannot be keyed always does.
-
Field Details
-
DEFAULT_TTL_SECONDS
public static final int DEFAULT_TTL_SECONDSDefault entry lifetime, in seconds.- See Also:
-
DEFAULT_MAX_ACCOUNTS
public static final int DEFAULT_MAX_ACCOUNTSDefault number of accounts kept per node.- See Also:
-
-
Constructor Details
-
BlueMindSessionCache
public BlueMindSessionCache(int ttlSeconds, int maxAccounts) A cache on the system clock.- Parameters:
ttlSeconds- how long an entry is kept; zero or less keeps nothingmaxAccounts- how many accounts are kept at once; zero or less keeps nothing
-
-
Method Details
-
unpooled
A cache that keeps nothing: every call opens its own session and closes it, as a call that cannot be keyed always does.- Returns:
- a cache of no capacity
-