Class RedisConnector
- All Implemented Interfaces:
BackendConnector
-
Constructor Summary
ConstructorsConstructorDescriptionRedisConnector(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSession(String clusterKey) Removes session data from the backend storage.getSession(String clusterKey) Retrieves session data from the backend storage by cluster key.voidmarkDeserializationComplete(String clusterKey) Marks the successful completion of the deserialization process for a session.voidmarkDeserializationFailed(String clusterKey, Throwable error) Marks the deserialization process as failed for a session.booleanmarkDeserializationStarted(String clusterKey, Duration timeToLive) Marks the beginning of the deserialization process for a session.voidmarkSerializationComplete(String clusterKey) Marks the successful completion of the serialization process for a session.voidmarkSerializationFailed(String clusterKey, Throwable error) Marks the serialization process as failed for a session.voidmarkSerializationStarted(String clusterKey, Duration timeToLive) Marks the beginning of the serialization process for a session.voidsendSession(SessionInfo sessionInfo) Stores serialized session data in the backend storage.
-
Constructor Details
-
RedisConnector
public RedisConnector(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
-
-
Method Details
-
sendSession
Description copied from interface:BackendConnectorStores serialized session data in the backend storage.- Specified by:
sendSessionin interfaceBackendConnector- Parameters:
sessionInfo- the session information containing the cluster key, serialized data, and time-to-live settings.
-
getSession
Description copied from interface:BackendConnectorRetrieves session data from the backend storage by cluster key.- Specified by:
getSessionin interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.- Returns:
- the session information containing the serialized data, or
nullif no session is found for the given key.
-
markSerializationStarted
Description copied from interface:BackendConnectorMarks the beginning of the serialization process for a session.This method is used for coordination between multiple requests to indicate that serialization is in progress and prevent concurrent access issues. Implementors can decide if the method should block in case of concurrent requests; potential acquired locks should be released in
BackendConnector.markSerializationComplete(String)andBackendConnector.markSerializationFailed(String, Throwable)methods.- Specified by:
markSerializationStartedin interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.timeToLive- the maximum amount of time the serialization marker should be preserved in the backend. A zero or negative value means the marker should not be evicted.
-
markSerializationComplete
Description copied from interface:BackendConnectorMarks the successful completion of the serialization process for a session.This method is called after session data has been successfully serialized and stored in the backend. Any lock has been acquired by
BackendConnector.markSerializationStarted(String, Duration)should be released here.- Specified by:
markSerializationCompletein interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.
-
markSerializationFailed
Description copied from interface:BackendConnectorMarks the serialization process as failed for a session.This method is called when an error occurs during the serialization process to record the failure and its cause. Any lock has been acquired by
BackendConnector.markSerializationStarted(String, Duration)should be released here.- Specified by:
markSerializationFailedin interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.error- the error that caused the serialization to fail.
-
markDeserializationStarted
Description copied from interface:BackendConnectorMarks the beginning of the deserialization process for a session.This method is used for coordination between multiple requests to indicate that serialization is in progress and prevent concurrent access issues. Implementors can decide if the method should block in case of concurrent requests; potential acquired locks should be released in
BackendConnector.markDeserializationComplete(String)andBackendConnector.markDeserializationFailed(String, Throwable)methods.- Specified by:
markDeserializationStartedin interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.timeToLive- the maximum amount of time the serialization marker should be preserved in the backend. A zero or negative value means the marker should not be evicted.- Returns:
- true if there is no pending deserialization process, otherwise false.
-
markDeserializationComplete
Description copied from interface:BackendConnectorMarks the successful completion of the deserialization process for a session.This method is called after session data has been successfully deserialized. Any lock that has been acquired by
BackendConnector.markDeserializationStarted(String, Duration)should be released here.- Specified by:
markDeserializationCompletein interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.
-
markDeserializationFailed
Description copied from interface:BackendConnectorMarks the deserialization process as failed for a session.This method is called when an error occurs during the serialization process to record the failure and its cause. Any lock that has been acquired by
BackendConnector.markDeserializationStarted(String, Duration)should be released here.- Specified by:
markDeserializationFailedin interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session.error- the error that caused the serialization to fail.
-
deleteSession
Description copied from interface:BackendConnectorRemoves session data from the backend storage.- Specified by:
deleteSessionin interfaceBackendConnector- Parameters:
clusterKey- the distributed storage key identifying the session to delete.
-