From 04c0faec725f0e88dd358982760e1ee29350cbf0 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Tue, 11 Jan 2022 12:46:22 -0800 Subject: [PATCH 1/6] add docstrings to Momento class methods --- src/momento/momento.py | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/momento/momento.py b/src/momento/momento.py index 1bae3b80..8c6a0311 100644 --- a/src/momento/momento.py +++ b/src/momento/momento.py @@ -16,6 +16,12 @@ class Momento: def __init__(self, auth_token, endpoint_override=None): + """Inits Momento to setup SCS client. + + Args: + auth_token: Momento JWT + endpoint_override: String of optional endpoint ovveride to be used when given an explicit endpoint by the Momneto team + """ endpoints = _momento_endpoint_resolver.resolve(auth_token, endpoint_override) self._auth_token = auth_token @@ -36,6 +42,17 @@ def __exit__(self, exc_type, exc_value, exc_traceback): self._secure_channel.close() def create_cache(self, cache_name): + """Creates a new cache in your Momento account. + + Args: + cache_name: String used to create cache. + + Returns: + CreateCacheResponse + + Raises: + Exception to notify cache creation failure. + """ try: _momento_logger.debug(f'Creating cache with name: {cache_name}') request = CreateCacheRequest() @@ -46,6 +63,17 @@ def create_cache(self, cache_name): raise _cache_service_errors_converter.convert(e) from None def delete_cache(self, cache_name): + """Deletes a cache and all of the items within it. + + Args: + cache_name: String cache name to delete. + + Returns: + DeleteCacheResponse + + Raises: + Exception to notify cache deletion failure. + """ try: _momento_logger.debug(f'Deleting cache with name: {cache_name}') request = DeleteCacheRequest() @@ -56,6 +84,19 @@ def delete_cache(self, cache_name): raise _cache_service_errors_converter.convert(e) from None def get_cache(self, cache_name, ttl_seconds, create_if_absent=False): + """Gets a MomentoCache to perform gets and sets on. + + Args: + cache_name: String cache name + ttl_seconds: Time to live if object insdie of cache in seconds. + create_if_absent: Boolean value to decide if cahce should be created if it does not exist. + + Returns: + Cache + + Raises: + CacheNotFoundError + """ cache = Cache(self._auth_token, cache_name, self._cache_endpoint, ttl_seconds) try: @@ -69,6 +110,17 @@ def get_cache(self, cache_name, ttl_seconds, create_if_absent=False): return cache._connect() def list_caches(self, next_token=None): + """Lists ll caches. + + Args: + next_token: Token to continue paginating through the list. It's ised to hnadle large paginated lists. + + Returns: + ListCachesResponse + + Raises: + Exception to notify either sdk, grpc, or operation error. + """ try: list_caches_request = ListCachesRequest() list_caches_request.next_token = next_token if next_token is not None else '' From cbc1f803bac4b24622efee97dc95cdb1150f06d1 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Tue, 11 Jan 2022 14:38:36 -0800 Subject: [PATCH 2/6] add docstrings to Cache class methods --- src/momento/cache.py | 44 ++++++++++++++++++++++++++++++++++++++---- src/momento/momento.py | 4 ++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/momento/cache.py b/src/momento/cache.py index 7a6f618f..2cbe30d7 100644 --- a/src/momento/cache.py +++ b/src/momento/cache.py @@ -14,6 +14,14 @@ class Cache: def __init__(self, auth_token, cache_name, endpoint, default_ttlSeconds): + """Inits Cache to perform gets and sets. + + Args: + auth_token: Momento JWT token. + cahce_name: String of cache name to perform gets and sets. + end_point: String of endpoint to reach Momento Cache + default_ttlSeconds: The default time to live of object inside of cache in seconds. + """ self._validate_ttl(default_ttlSeconds) self._default_ttlSeconds = default_ttlSeconds self._secure_channel = grpc.secure_channel( @@ -27,11 +35,15 @@ def __init__(self, auth_token, cache_name, endpoint, default_ttlSeconds): cache_interceptor) self._client = cache_client.ScsStub(intercept_channel) - # While the constructor opens the grpc channel. Connect allows the channel - # to test the connection with provided cache name and auth token. - # Separating the _connect from the constructor, allows better latency and - # resource management for calls that need get or create functionality. + def _connect(self) : + """Connects the cache to backend. + + While the constructor opens the grpc channel. Connect allows the channel + to test the connection with provided cache name and auth token. + Separating the _connect from the constructor, allows better latency and + resource management for calls that need get or create functionality. + """ try: _momento_logger.debug('Initializing connection with Cache Service') self.get(uuid.uuid1().bytes) @@ -48,6 +60,19 @@ def __exit__(self, exc_type, exc_value, exc_traceback): self._secure_channel.close() def set(self, key, value, ttl_seconds=None): + """Set key/value pair in the cache. + + Args: + key: String or bytes. + value: String or bytes. + ttl_seconds: Time to live in cache in seconds. + + Returns: + CacheSetResponse + + Raises: + Exception to notify either sdk, grpc, or operation error. + """ try: _momento_logger.debug(f'Issuing a set request with key {key}') item_ttl_seconds = self._default_ttlSeconds if ttl_seconds is None else ttl_seconds @@ -67,6 +92,17 @@ def set(self, key, value, ttl_seconds=None): raise _cache_service_errors_converter.convert(e) def get(self, key): + """Get value based on provided key in the cache. + + Args: + key: String or bytes. + + Returns: + CacheGetResponse + + Raises: + Exception to notify either sdk, grpc, or operation error. + """ try: _momento_logger.debug(f'Issuing a get request with key {key}') get_request = cache_client_types.GetRequest() diff --git a/src/momento/momento.py b/src/momento/momento.py index 8c6a0311..0ad5df98 100644 --- a/src/momento/momento.py +++ b/src/momento/momento.py @@ -51,7 +51,7 @@ def create_cache(self, cache_name): CreateCacheResponse Raises: - Exception to notify cache creation failure. + Exception to notify either sdk, grpc, or operation error. """ try: _momento_logger.debug(f'Creating cache with name: {cache_name}') @@ -72,7 +72,7 @@ def delete_cache(self, cache_name): DeleteCacheResponse Raises: - Exception to notify cache deletion failure. + Exception to notify either sdk, grpc, or operation error. """ try: _momento_logger.debug(f'Deleting cache with name: {cache_name}') From 1d9a7a3c3c06774d12edb35996a2df42e38ffdc4 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Tue, 11 Jan 2022 14:53:53 -0800 Subject: [PATCH 3/6] add docstrings to cache operation responses' classes' methods --- src/momento/cache_operation_responses.py | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/momento/cache_operation_responses.py b/src/momento/cache_operation_responses.py index 0f281720..be49ca01 100644 --- a/src/momento/cache_operation_responses.py +++ b/src/momento/cache_operation_responses.py @@ -11,6 +11,15 @@ class CacheResult(Enum): class CacheSetResponse: def __init__(self, grpc_set_response, value): + """Inits CacheSetResponse to handle gRPC set response. + + Args: + grpc_set_response: Response returned from set operation. + value: String value set in chache. + + Raises: + Error to notify either sdk, grpc, or operation error. + """ self._value = value if (grpc_set_response.result != cache_client_types.Ok): _momento_logger.debug(f'Set received unsupported ECacheResult {grpc_set_response.result}') @@ -18,14 +27,24 @@ def __init__(self, grpc_set_response, value): grpc_set_response.result, grpc_set_response.message, 'SET') def str_utf8(self): + """Decodes string value set in cache to a utf-8 string.""" return self._value.decode('utf-8') def bytes(self): + """Returns byte value set in cache.""" return self._value class CacheGetResponse: def __init__(self, grpc_get_response): + """Initis CacheGetResponse to handle gRPC get response. + + Args: + grpc_get_response: Response returned from get operation. + + Raises: + Error to notify either sdk, grpc, or operation error. + """ self._value = grpc_get_response.cache_body if (grpc_get_response.result == cache_client_types.Hit): @@ -39,16 +58,19 @@ def __init__(self, grpc_get_response): def str_utf8(self): + """Decodes string value got from cache to a utf-8 string.""" if (self._result == CacheResult.HIT): return self._value.decode('utf-8') return None def bytes(self): + """Returns byte value got from cache.""" if (self._result == CacheResult.HIT): return self._value return None def result(self): + """Returns get operation result such as HIT or MISS.""" return self._result @@ -64,21 +86,34 @@ def __init__(self, grpc_delete_cache_response): class ListCachesResponse: def __init__(self, grpc_list_cache_response): + """Inits ListCacheResponse to handle list cache response. + + Args: + gprc_list_cache_response: Response returned from list operation. + """ self._next_token = grpc_list_cache_response.next_token if grpc_list_cache_response.next_token != '' else None self._caches = [] for cache in grpc_list_cache_response.cache: self._caches.append(CacheInfo(cache)) def next_token(self): + """Returns next token.""" return self._next_token def caches(self): + """Returns all caches.""" return self._caches class CacheInfo: def __init__(self, grpc_listed_caches): + """Inits CacheInfo to handle caches returned from list cache operation. + + Args: + grpc_listed_caches: All caches' information returned from list cache. + """ self._name = grpc_listed_caches.cache_name def name(self): + """Returns all caches' names.""" return self._name From 9265939ed549f0829eed5ee9038860d7ed7a190a Mon Sep 17 00:00:00 2001 From: erikatharp Date: Tue, 11 Jan 2022 16:40:47 -0800 Subject: [PATCH 4/6] fix typos and update docstrings --- src/momento/cache.py | 34 ++++++++++++------- src/momento/cache_operation_responses.py | 42 +++++++++++++++--------- src/momento/momento.py | 10 +++--- 3 files changed, 55 insertions(+), 31 deletions(-) diff --git a/src/momento/cache.py b/src/momento/cache.py index 2cbe30d7..d095f103 100644 --- a/src/momento/cache.py +++ b/src/momento/cache.py @@ -14,13 +14,13 @@ class Cache: def __init__(self, auth_token, cache_name, endpoint, default_ttlSeconds): - """Inits Cache to perform gets and sets. + """Initializes Cache to perform gets and sets. Args: auth_token: Momento JWT token. - cahce_name: String of cache name to perform gets and sets. + cache_name: Name of the cache end_point: String of endpoint to reach Momento Cache - default_ttlSeconds: The default time to live of object inside of cache in seconds. + default_ttlSeconds: Time (in seconds) for which an item will be stored in the cache. """ self._validate_ttl(default_ttlSeconds) self._default_ttlSeconds = default_ttlSeconds @@ -60,18 +60,24 @@ def __exit__(self, exc_type, exc_value, exc_traceback): self._secure_channel.close() def set(self, key, value, ttl_seconds=None): - """Set key/value pair in the cache. + """Stores an item in cache Args: - key: String or bytes. - value: String or bytes. - ttl_seconds: Time to live in cache in seconds. + key (string or bytes): The key to be used to store item in the cache. + value (string or bytes): The value to be used to store item in the cache. + ttl_second (Optional): Time to live in cache in seconds. If not provided default TTL provided while creating the cache client instance is used. Returns: CacheSetResponse Raises: - Exception to notify either sdk, grpc, or operation error. + CacheValueError: If service validation fails for provided values. + CacheNotFoundError: If an attempt is made to store an item in a cache that doesn't exist. + PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. + ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. + The request either did not make it to the service or if it did the response from the service could not be parsed successfully. + InternalServerError: If server encountered an unknown error while trying to store the item. + SdkError: Base exception for all errors raised by Sdk. """ try: _momento_logger.debug(f'Issuing a set request with key {key}') @@ -92,16 +98,22 @@ def set(self, key, value, ttl_seconds=None): raise _cache_service_errors_converter.convert(e) def get(self, key): - """Get value based on provided key in the cache. + """Retrieve an item from the cache Args: - key: String or bytes. + key (string or bytes): The key to be used to retrieve item from the cache. Returns: CacheGetResponse Raises: - Exception to notify either sdk, grpc, or operation error. + CacheValueError: If service validation fails for provided values. + CacheNotFoundError: If an attempt is made to retrieve an item in a cache that doesn't exist. + PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. + ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. + The request either did not make it to the service or if it did the response from the service could not be parsed successfully. + InternalServerError: If server encountered an unknown error while trying to retrieve the item. + SdkError: Base exception for all errors raised by Sdk. """ try: _momento_logger.debug(f'Issuing a get request with key {key}') diff --git a/src/momento/cache_operation_responses.py b/src/momento/cache_operation_responses.py index be49ca01..8420a511 100644 --- a/src/momento/cache_operation_responses.py +++ b/src/momento/cache_operation_responses.py @@ -11,14 +11,20 @@ class CacheResult(Enum): class CacheSetResponse: def __init__(self, grpc_set_response, value): - """Inits CacheSetResponse to handle gRPC set response. + """Initializes CacheSetResponse to handle gRPC set response. Args: - grpc_set_response: Response returned from set operation. - value: String value set in chache. + grpc_set_response: Protobuf based response returned by Scs. + value (string or bytes): The value to be used to store item in the cache Raises: - Error to notify either sdk, grpc, or operation error. + CacheValueError: If service validation fails for provided values. + CacheNotFoundError: If an attempt is made to store an item in a cache that doesn't exist. + PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. + ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. + The request either did not make it to the service or if it did the response from the service could not be parsed successfully. + InternalServerError: If server encountered an unknown error while trying to store the item. + SdkError: Base exception for all errors raised by Sdk. """ self._value = value if (grpc_set_response.result != cache_client_types.Ok): @@ -37,13 +43,19 @@ def bytes(self): class CacheGetResponse: def __init__(self, grpc_get_response): - """Initis CacheGetResponse to handle gRPC get response. + """Initializes CacheGetResponse to handle gRPC get response. Args: - grpc_get_response: Response returned from get operation. + grpc_get_response: Protobuf based response returned by Scs. Raises: - Error to notify either sdk, grpc, or operation error. + CacheValueError: If service validation fails for provided values. + CacheNotFoundError: If an attempt is made to retrieve an item in a cache that doesn't exist. + PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. + ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. + The request either did not make it to the service or if it did the response from the service could not be parsed successfully. + InternalServerError: If server encountered an unknown error while trying to retrieve the item. + SdkError: Base exception for all errors raised by Sdk. """ self._value = grpc_get_response.cache_body @@ -58,13 +70,13 @@ def __init__(self, grpc_get_response): def str_utf8(self): - """Decodes string value got from cache to a utf-8 string.""" + """Returns value stored in cache as utf-8 string if there was Hit. Returns None otherwise.""" if (self._result == CacheResult.HIT): return self._value.decode('utf-8') return None def bytes(self): - """Returns byte value got from cache.""" + """Returns value stored in cache as bytes if there was Hit. Returns None otherwise.""" if (self._result == CacheResult.HIT): return self._value return None @@ -86,10 +98,10 @@ def __init__(self, grpc_delete_cache_response): class ListCachesResponse: def __init__(self, grpc_list_cache_response): - """Inits ListCacheResponse to handle list cache response. + """Initializes ListCacheResponse to handle list cache response. Args: - gprc_list_cache_response: Response returned from list operation. + grpc_list_cache_response: Protobuf based response returned by Scs. """ self._next_token = grpc_list_cache_response.next_token if grpc_list_cache_response.next_token != '' else None self._caches = [] @@ -106,13 +118,13 @@ def caches(self): class CacheInfo: - def __init__(self, grpc_listed_caches): - """Inits CacheInfo to handle caches returned from list cache operation. + def __init__(self, grpc_listed_cache): + """Initializes CacheInfo to handle caches returned from list cache operation. Args: - grpc_listed_caches: All caches' information returned from list cache. + grpc_listed_cache: Protobuf based response returned by Scs. """ - self._name = grpc_listed_caches.cache_name + self._name = grpc_listed_cache.cache_name def name(self): """Returns all caches' names.""" diff --git a/src/momento/momento.py b/src/momento/momento.py index 0ad5df98..aca88304 100644 --- a/src/momento/momento.py +++ b/src/momento/momento.py @@ -16,11 +16,11 @@ class Momento: def __init__(self, auth_token, endpoint_override=None): - """Inits Momento to setup SCS client. + """Initializes Momento to setup SCS client. Args: auth_token: Momento JWT - endpoint_override: String of optional endpoint ovveride to be used when given an explicit endpoint by the Momneto team + endpoint_override: String of optional endpoint override to be used when given an explicit endpoint by the Momneto team """ endpoints = _momento_endpoint_resolver.resolve(auth_token, endpoint_override) @@ -89,7 +89,7 @@ def get_cache(self, cache_name, ttl_seconds, create_if_absent=False): Args: cache_name: String cache name ttl_seconds: Time to live if object insdie of cache in seconds. - create_if_absent: Boolean value to decide if cahce should be created if it does not exist. + create_if_absent: Boolean value to decide if cache should be created if it does not exist. Returns: Cache @@ -110,10 +110,10 @@ def get_cache(self, cache_name, ttl_seconds, create_if_absent=False): return cache._connect() def list_caches(self, next_token=None): - """Lists ll caches. + """Lists all caches. Args: - next_token: Token to continue paginating through the list. It's ised to hnadle large paginated lists. + next_token: Token to continue paginating through the list. It's used to handle large paginated lists. Returns: ListCachesResponse From 4476ca8f099a6b4e1136132935009061ae112796 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Wed, 12 Jan 2022 17:05:48 -0800 Subject: [PATCH 5/6] remove SdkError from Raises --- src/momento/cache.py | 2 -- src/momento/cache_operation_responses.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/momento/cache.py b/src/momento/cache.py index d095f103..15b4b6ce 100644 --- a/src/momento/cache.py +++ b/src/momento/cache.py @@ -77,7 +77,6 @@ def set(self, key, value, ttl_seconds=None): ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to store the item. - SdkError: Base exception for all errors raised by Sdk. """ try: _momento_logger.debug(f'Issuing a set request with key {key}') @@ -113,7 +112,6 @@ def get(self, key): ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to retrieve the item. - SdkError: Base exception for all errors raised by Sdk. """ try: _momento_logger.debug(f'Issuing a get request with key {key}') diff --git a/src/momento/cache_operation_responses.py b/src/momento/cache_operation_responses.py index 8420a511..8b2ec2a4 100644 --- a/src/momento/cache_operation_responses.py +++ b/src/momento/cache_operation_responses.py @@ -24,7 +24,6 @@ def __init__(self, grpc_set_response, value): ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to store the item. - SdkError: Base exception for all errors raised by Sdk. """ self._value = value if (grpc_set_response.result != cache_client_types.Ok): @@ -55,7 +54,6 @@ def __init__(self, grpc_get_response): ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to retrieve the item. - SdkError: Base exception for all errors raised by Sdk. """ self._value = grpc_get_response.cache_body From 0ce36a0c51c0e8983264a679c78650cc6865a777 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Wed, 12 Jan 2022 18:17:25 -0800 Subject: [PATCH 6/6] update Raises section to match only possible errors thrown --- src/momento/cache.py | 4 ---- src/momento/cache_operation_responses.py | 12 +----------- src/momento/momento.py | 8 +++++--- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/momento/cache.py b/src/momento/cache.py index 15b4b6ce..cb17d886 100644 --- a/src/momento/cache.py +++ b/src/momento/cache.py @@ -74,8 +74,6 @@ def set(self, key, value, ttl_seconds=None): CacheValueError: If service validation fails for provided values. CacheNotFoundError: If an attempt is made to store an item in a cache that doesn't exist. PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. - ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. - The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to store the item. """ try: @@ -109,8 +107,6 @@ def get(self, key): CacheValueError: If service validation fails for provided values. CacheNotFoundError: If an attempt is made to retrieve an item in a cache that doesn't exist. PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. - ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. - The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to retrieve the item. """ try: diff --git a/src/momento/cache_operation_responses.py b/src/momento/cache_operation_responses.py index 8b2ec2a4..f7da6aeb 100644 --- a/src/momento/cache_operation_responses.py +++ b/src/momento/cache_operation_responses.py @@ -18,11 +18,6 @@ def __init__(self, grpc_set_response, value): value (string or bytes): The value to be used to store item in the cache Raises: - CacheValueError: If service validation fails for provided values. - CacheNotFoundError: If an attempt is made to store an item in a cache that doesn't exist. - PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. - ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. - The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to store the item. """ self._value = value @@ -48,11 +43,6 @@ def __init__(self, grpc_get_response): grpc_get_response: Protobuf based response returned by Scs. Raises: - CacheValueError: If service validation fails for provided values. - CacheNotFoundError: If an attempt is made to retrieve an item in a cache that doesn't exist. - PermissionError: If the provided Momento Auth Token is invalid to perform the requested operation. - ClientSdkError: For all errors raised by the client. Indicates that the request failed on the SDK. - The request either did not make it to the service or if it did the response from the service could not be parsed successfully. InternalServerError: If server encountered an unknown error while trying to retrieve the item. """ self._value = grpc_get_response.cache_body @@ -125,5 +115,5 @@ def __init__(self, grpc_listed_cache): self._name = grpc_listed_cache.cache_name def name(self): - """Returns all caches' names.""" + """Returns all cache's name.""" return self._name diff --git a/src/momento/momento.py b/src/momento/momento.py index aca88304..14b41b10 100644 --- a/src/momento/momento.py +++ b/src/momento/momento.py @@ -51,7 +51,7 @@ def create_cache(self, cache_name): CreateCacheResponse Raises: - Exception to notify either sdk, grpc, or operation error. + ClientSdkError: If an attempt is made to pass anything other than string as cache_name. """ try: _momento_logger.debug(f'Creating cache with name: {cache_name}') @@ -72,7 +72,8 @@ def delete_cache(self, cache_name): DeleteCacheResponse Raises: - Exception to notify either sdk, grpc, or operation error. + CacheNotFoundError: If an attempt is made to delete a MomentoCache that doesn't exits. + ClientSdkError: If an attempt is made to pass anything other than string as cache_name. """ try: _momento_logger.debug(f'Deleting cache with name: {cache_name}') @@ -95,7 +96,8 @@ def get_cache(self, cache_name, ttl_seconds, create_if_absent=False): Cache Raises: - CacheNotFoundError + CacheNotFoundError: If an attempt is made to get a MomentoCache that doesn't exits. + ClientSdkError: If an attempt is made to pass anything other than string as cache_name. """ cache = Cache(self._auth_token, cache_name, self._cache_endpoint, ttl_seconds)