How to Install and Uninstall python3-aiocache Package on Kali Linux
Last updated: December 25,2024
1. Install "python3-aiocache" package
In this section, we are going to explain the necessary steps to install python3-aiocache on Kali Linux
$
sudo apt update
Copied
$
sudo apt install
python3-aiocache
Copied
2. Uninstall "python3-aiocache" package
Please follow the step by step instructions below to uninstall python3-aiocache on Kali Linux:
$
sudo apt remove
python3-aiocache
Copied
$
sudo apt autoclean && sudo apt autoremove
Copied
3. Information about the python3-aiocache package on Kali Linux
Package: python3-aiocache
Source: aiocache
Version: 0.12.2-1
Installed-Size: 123
Maintainer: Gianfranco Costamagna
Architecture: all
Depends: python3:any
Recommends: python3-aiomcache, python3-msgpack, python3-redis
Size: 26948
SHA256: b6428ec16a0d7190b001f031aec950cb88e4a5c796145c0b55509562d5b82bfa
SHA1: 385405fc345439b8cff85bc02c436ba55f5083ea
MD5sum: 6b04263c010a116df0f04c2b003cda9b
Description: multi backend asyncio cache
Asyncio cache supporting multiple backends (memory, redis and memcached).
This library aims for simplicity over specialization.
All caches contain the same minimum interface which consists on the following
functions:
.
- ``add``: Only adds key/value if key does not exist.
- ``get``: Retrieve value identified by key.
- ``set``: Sets key/value.
- ``multi_get``: Retrieves multiple key/values.
- ``multi_set``: Sets multiple key/values.
- ``exists``: Returns True if key exists False otherwise.
- ``increment``: Increment the value stored in the given key.
- ``delete``: Deletes key and returns number of deleted items.
- ``clear``: Clears the items stored.
- ``raw``: Executes the specified command using the underlying client.
.
.. role:: python(code)
:language: python
.
.. contents::
.
.. section-numbering:
.
Usage
=====
.
Using a cache is as simple as
.
.. code-block:: python
.
>>> import asyncio
>>> from aiocache import Cache
>>> cache = Cache(Cache.MEMORY) # Here you can also use Cache.REDIS and Cache.MEMCACHED, default is Cache.MEMORY
>>> with asyncio.Runner() as runner:
>>> runner.run(cache.set('key', 'value'))
True
>>> runner.run(cache.get('key'))
'value'
.
Or as a decorator
.
.. code-block:: python
.
import asyncio
.
from collections import namedtuple
.
from aiocache import cached, Cache
from aiocache.serializers import PickleSerializer
# With this we can store python objects in backends like Redis!
.
Result = namedtuple('Result', "content, status")
.
.
@cached(
ttl=10, cache=Cache.REDIS, key="key", serializer=PickleSerializer(), port=6379, namespace="main")
async def cached_call():
print("Sleeping for three seconds zzzz.....")
await asyncio.sleep(3)
return Result("content", 200)
.
.
async def run():
await cached_call()
await cached_call()
await cached_call()
cache = Cache(Cache.REDIS, endpoint="127.0.0.1", port=6379, namespace="main")
await cache.delete("key")
.
if __name__ == "__main__":
asyncio.run(run())
.
The recommended approach to instantiate a new cache is using the `Cache` constructor.
However you can also instantiate directly using `aiocache.RedisCache`,
`aiocache.SimpleMemoryCache` or `aiocache.MemcachedCache`.
.
.
You can also setup cache aliases so its easy to reuse configurations
.
.. code-block:: python
.
import asyncio
.
from aiocache import caches
.
# You can use either classes or strings for referencing classes
caches.set_config({
'default': {
'cache': "aiocache.SimpleMemoryCache",
'serializer': {
'class': "aiocache.serializers.StringSerializer"
}
},
'redis_alt': {
'cache': "aiocache.RedisCache",
'endpoint': "127.0.0.1",
'port': 6379,
'timeout': 1,
'serializer': {
'class': "aiocache.serializers.PickleSerializer"
},
'plugins': [
{'class': "aiocache.plugins.HitMissRatioPlugin"},
{'class': "aiocache.plugins.TimingPlugin"}
]
}
})
.
.
async def default_cache():
cache = caches.get('default') # This always returns the SAME instance
await cache.set("key", "value")
assert await cache.get("key") == "value"
.
.
async def alt_cache():
cache = caches.create('redis_alt') # This creates a NEW instance on every call
await cache.set("key", "value")
assert await cache.get("key") == "value"
.
.
async def test_alias():
await default_cache()
await alt_cache()
.
await caches.get("redis_alt").delete("key")
.
.
if __name__ == "__main__":
asyncio.run(test_alias())
Description-md5:
Homepage: https://github.com/aio-libs/aiocache
Section: python
Priority: optional
Filename: pool/main/a/aiocache/python3-aiocache_0.12.2-1_all.deb
Source: aiocache
Version: 0.12.2-1
Installed-Size: 123
Maintainer: Gianfranco Costamagna
Architecture: all
Depends: python3:any
Recommends: python3-aiomcache, python3-msgpack, python3-redis
Size: 26948
SHA256: b6428ec16a0d7190b001f031aec950cb88e4a5c796145c0b55509562d5b82bfa
SHA1: 385405fc345439b8cff85bc02c436ba55f5083ea
MD5sum: 6b04263c010a116df0f04c2b003cda9b
Description: multi backend asyncio cache
Asyncio cache supporting multiple backends (memory, redis and memcached).
This library aims for simplicity over specialization.
All caches contain the same minimum interface which consists on the following
functions:
.
- ``add``: Only adds key/value if key does not exist.
- ``get``: Retrieve value identified by key.
- ``set``: Sets key/value.
- ``multi_get``: Retrieves multiple key/values.
- ``multi_set``: Sets multiple key/values.
- ``exists``: Returns True if key exists False otherwise.
- ``increment``: Increment the value stored in the given key.
- ``delete``: Deletes key and returns number of deleted items.
- ``clear``: Clears the items stored.
- ``raw``: Executes the specified command using the underlying client.
.
.. role:: python(code)
:language: python
.
.. contents::
.
.. section-numbering:
.
Usage
=====
.
Using a cache is as simple as
.
.. code-block:: python
.
>>> import asyncio
>>> from aiocache import Cache
>>> cache = Cache(Cache.MEMORY) # Here you can also use Cache.REDIS and Cache.MEMCACHED, default is Cache.MEMORY
>>> with asyncio.Runner() as runner:
>>> runner.run(cache.set('key', 'value'))
True
>>> runner.run(cache.get('key'))
'value'
.
Or as a decorator
.
.. code-block:: python
.
import asyncio
.
from collections import namedtuple
.
from aiocache import cached, Cache
from aiocache.serializers import PickleSerializer
# With this we can store python objects in backends like Redis!
.
Result = namedtuple('Result', "content, status")
.
.
@cached(
ttl=10, cache=Cache.REDIS, key="key", serializer=PickleSerializer(), port=6379, namespace="main")
async def cached_call():
print("Sleeping for three seconds zzzz.....")
await asyncio.sleep(3)
return Result("content", 200)
.
.
async def run():
await cached_call()
await cached_call()
await cached_call()
cache = Cache(Cache.REDIS, endpoint="127.0.0.1", port=6379, namespace="main")
await cache.delete("key")
.
if __name__ == "__main__":
asyncio.run(run())
.
The recommended approach to instantiate a new cache is using the `Cache` constructor.
However you can also instantiate directly using `aiocache.RedisCache`,
`aiocache.SimpleMemoryCache` or `aiocache.MemcachedCache`.
.
.
You can also setup cache aliases so its easy to reuse configurations
.
.. code-block:: python
.
import asyncio
.
from aiocache import caches
.
# You can use either classes or strings for referencing classes
caches.set_config({
'default': {
'cache': "aiocache.SimpleMemoryCache",
'serializer': {
'class': "aiocache.serializers.StringSerializer"
}
},
'redis_alt': {
'cache': "aiocache.RedisCache",
'endpoint': "127.0.0.1",
'port': 6379,
'timeout': 1,
'serializer': {
'class': "aiocache.serializers.PickleSerializer"
},
'plugins': [
{'class': "aiocache.plugins.HitMissRatioPlugin"},
{'class': "aiocache.plugins.TimingPlugin"}
]
}
})
.
.
async def default_cache():
cache = caches.get('default') # This always returns the SAME instance
await cache.set("key", "value")
assert await cache.get("key") == "value"
.
.
async def alt_cache():
cache = caches.create('redis_alt') # This creates a NEW instance on every call
await cache.set("key", "value")
assert await cache.get("key") == "value"
.
.
async def test_alias():
await default_cache()
await alt_cache()
.
await caches.get("redis_alt").delete("key")
.
.
if __name__ == "__main__":
asyncio.run(test_alias())
Description-md5:
Homepage: https://github.com/aio-libs/aiocache
Section: python
Priority: optional
Filename: pool/main/a/aiocache/python3-aiocache_0.12.2-1_all.deb