
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
async-cache
Advanced tools
:info: A caching solution for asyncio
.. image:: https://img.shields.io/pypi/v/async-cache.svg :target: https://pypi.python.org/pypi/async-cache .. image:: https://www.codetriage.com/iamsinghrajat/async-cache/badges/users.svg :target: https://pypi.python.org/pypi/async-cache .. image:: https://static.pepy.tech/personalized-badge/async-cache?period=total&units=international_system&left_color=black&right_color=blue&left_text=Downloads :target: https://pepy.tech/project/async-cache .. image:: https://snyk.io/advisor/python/async-cache/badge.svg :target: https://snyk.io/advisor/python/async-cache :alt: async-cache
.. code-block:: shell
pip install async-cache
.. code-block:: python
# LRU Cache
from cache import AsyncLRU
@AsyncLRU(maxsize=128)
async def func(*args, **kwargs):
"""
maxsize : max number of results that are cached.
if max limit is reached the oldest result is deleted.
"""
pass
# TTL Cache
from cache import AsyncTTL
@AsyncTTL(time_to_live=60, maxsize=1024, skip_args=1)
async def func(*args, **kwargs):
"""
time_to_live : max time for which a cached result is valid (in seconds)
maxsize : max number of results that are cached.
if max limit is reached the oldest result is deleted.
skip_args : Use `1` to skip first arg of func in determining cache key
"""
pass
# Supports primitive as well as non-primitive function parameter.
# Currently TTL & LRU cache is supported.
.. code-block:: python
class CustomDataClass:
id: int
value: int
from cache import AsyncLRU
@AsyncLRU(maxsize=128)
async def func(model: "CustomDataClass"):
...
# function logic
...
# async-cache will work even if function parameters are:
# 1. orm objects
# 2. request object
# 3. any other custom object type.
# To refresh the function result use the `use_cache=False` param in the function invocation
func(*args, use_cache=False, **kwargs)
FAQs
an asyncio cache
We found that async-cache 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.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.