Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
LRU cache for Python. Use Redis as backend. Provides a dictionary-like object as well as a method decorator.
.. code-block:: bash
pip install redis-lru
It's often useful to have an lru redis cache. Of course, it's also desirable not to have the cache grow too large, and cache expiration is often desirable. This module provides such a cache.
redis-lru supports CPython 3.4+
For the most part, you can just use it like this:
.. code-block:: python
import redis
from redis_lru import RedisLRU
client = redis.StrictRedis()
cache = RedisLRU(client)
@cache
def f(x):
print("Calling f({})".format(x))
return x
f(3) # This will print "Calling f(3)", will return 3
f(3) # This will not print anything, but will return 3 (unless 15 minutes have passed between the first and second function call).
Additionally a datetime.time object can be provided to clear the cache at a specific time of the day:
.. code-block:: python
@cache(expire_on=datetime.time(hour=8)) # clear at 08:00 o'clock
def b(x):
print("Calling f({})".format(x))
return x
expire_on
parameter for @cache & RedisLRU support set ttl by datetime.time
objectsunique_key
automatically so your may never get touch this argument.redis_lru_cache
decorator and RedisLRUCacheDict
POP
, DEL
etc.FAQs
LRU cache for Python. Use Redis as backend. Provides a dictionary-like object as well as a method decorator.
We found that redis-lru demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.