88from typing import Any , Literal , Protocol
99
1010import redis
11+ from typing_extensions import deprecated
1112
1213from aws_lambda_powertools .utilities .idempotency import BasePersistenceLayer
1314from aws_lambda_powertools .utilities .idempotency .exceptions import (
2526logger = logging .getLogger (__name__ )
2627
2728
29+ @deprecated ("RedisPersistenceLayer will be removed in v4.0.0. Please use CacheProtocol instead." )
2830class RedisClientProtocol (Protocol ):
2931 """
30- Protocol class defining the interface for a Redis client.
32+ Protocol class defining the interface for a Cache client.
3133
32- This protocol outlines the expected behavior of a Redis client, allowing for
34+ This protocol outlines the expected behavior of a Cache client, allowing for
3335 standardization among different implementations and allowing customers to extend it
3436 in their own implementation.
3537
@@ -78,6 +80,7 @@ def delete(self, keys: bytes | str | memoryview) -> Any:
7880 raise NotImplementedError
7981
8082
83+ @deprecated ("RedisConnection will be removed in v4.0.0. Please use CacheConnection instead." )
8184class RedisConnection :
8285 def __init__ (
8386 self ,
@@ -91,26 +94,26 @@ def __init__(
9194 ssl : bool = True ,
9295 ) -> None :
9396 """
94- Initialize Redis connection which will be used in Redis persistence_store to support Idempotency
97+ Initialize Cache connection which will be used in Cache persistence_store to support Idempotency
9598
9699 Parameters
97100 ----------
98101 host: str, optional
99- Redis host
102+ Cache host
100103 port: int, optional: default 6379
101- Redis port
104+ Cache port
102105 username: str, optional
103- Redis username
106+ Cache username
104107 password: str, optional
105- Redis password
108+ Cache password
106109 url: str, optional
107- Redis connection string, using url will override the host/port in the previous parameters
110+ Cache connection string, using url will override the host/port in the previous parameters
108111 db_index: int, optional: default 0
109- Redis db index
112+ Cache db index
110113 mode: str, Literal["standalone","cluster"]
111- set Redis client mode, choose from standalone/cluster. The default is standalone
114+ set Cache client mode, choose from standalone/cluster. The default is standalone
112115 ssl: bool, optional: default True
113- set whether to use ssl for Redis connection
116+ set whether to use ssl for Cache connection
114117
115118 Example
116119 --------
@@ -122,8 +125,8 @@ def __init__(
122125 from aws_lambda_powertools.utilities.idempotency import (
123126 idempotent,
124127 )
125- from aws_lambda_powertools.utilities.idempotency.persistence.redis import (
126- RedisCachePersistenceLayer ,
128+ from aws_lambda_powertools.utilities.idempotency.persistence.cache import (
129+ CachePersistenceLayer ,
127130 )
128131
129132 from aws_lambda_powertools.utilities.typing import LambdaContext
@@ -204,6 +207,7 @@ def _init_client(self) -> RedisClientProtocol:
204207 raise IdempotencyPersistenceConnectionError ("Could not to connect to Redis" , exc ) from exc
205208
206209
210+ @deprecated ("RedisCachePersistenceLayer will be removed in v4.0.0. Please use CachePersistenceLayer instead." )
207211class RedisCachePersistenceLayer (BasePersistenceLayer ):
208212 def __init__ (
209213 self ,
0 commit comments