Store Configuration#
1) RedisStore#
RedisStore is developed based on the Redis API provided by redis-py.
In terms of Redis connection configuration management, the configuration naming of django-redis is basically used to reduce the learning cost.
from throttled import store
store.RedisStore(server="redis://127.0.0.1:6379/0", options={})
from throttled.asyncio import store
store.RedisStore(server="redis://127.0.0.1:6379/0", options={})
Arguments#
Parameter |
Description |
Default |
|---|---|---|
|
Standard Redis URL, you can use it to connect to Redis in any deployment mode, see Store Backends. |
|
|
<Options> |
|
Options#
Parameter |
Description |
Default |
|---|---|---|
|
ConnectionPool parameters. |
|
|
ConnectionPool parameters. |
|
|
|
|
|
|
|
|
|
|
|
ConnectionFactory is used to create and maintain ConnectionPool. |
Automatically select via the Standalone: |
|
RedisClient import path. |
Automatically select sync/async mode by default. Sync(Standalone/Sentinel): Async(Standalone/Sentinel): Sync(Cluster): Async(Cluster): |
|
ConnectionPool import path. |
Automatically select via the Sync(Standalone): Async(Standalone): Sync(Sentinel): Async(Sentinel): Cluster: “Disabled” |
|
Sentinel import path. |
Automatically select sync/async mode by default. Sync: Async: |
2) MemoryStore#
MemoryStore is essentially a memory-based
LRU Cache with expiration time.
from throttled import store
store.MemoryStore(options={"MAX_SIZE": 10240})
from throttled.asyncio import store
store.MemoryStore(options={"MAX_SIZE": 10240})
Arguments#
|
<Options> |
|
Options#
Parameter |
Description |
Default |
|---|---|---|
|
Maximum capacity. When the number of stored key-value pairs exceeds |
|