33import threading
44import time
55from functools import update_wrapper
6- from splitio . optional . loaders import asyncio
6+
77
88DEFAULT_MAX_AGE = 5
99DEFAULT_MAX_SIZE = 100
@@ -84,42 +84,6 @@ def get(self, *args, **kwargs):
8484 self ._rollover ()
8585 return node .value
8686
87- async def get_key (self , key ):
88- """
89- Fetch an item from the cache, return None if does not exist
90-
91- :param key: User supplied key
92- :type key: str/frozenset
93-
94- :return: Cached/Fetched object
95- :rtype: object
96- """
97- async with asyncio .Lock ():
98- node = self ._data .get (key )
99- if node is not None :
100- if self ._is_expired (node ):
101- return None
102- if node is None :
103- return None
104- node = self ._bubble_up (node )
105- return node .value
106-
107- async def add_key (self , key , value ):
108- """
109- Add an item from the cache.
110-
111- :param key: User supplied key
112- :type key: str/frozenset
113-
114- :param value: key value
115- :type value: str
116- """
117- async with asyncio .Lock ():
118- node = LocalMemoryCache ._Node (key , value , time .time (), None , None )
119- node = self ._bubble_up (node )
120- self ._data [key ] = node
121- self ._rollover ()
122-
12387 def remove_expired (self ):
12488 """Remove expired elements."""
12589 with self ._lock :
@@ -225,4 +189,4 @@ def _decorator(user_function):
225189 wrapper = lambda * args , ** kwargs : _cache .get (* args , ** kwargs ) # pylint: disable=unnecessary-lambda
226190 return update_wrapper (wrapper , user_function )
227191
228- return _decorator
192+ return _decorator
0 commit comments