Skip to content

🐛 RedisSaver does not support ttl config as documented #38

Closed
@comaserious

Description

@comaserious

Description:
According to the documentation, RedisSaver (or AsyncRedisSaver) should support a ttl configuration that allows setting a default time-to-live and control whether to refresh TTL on read. However, using the documented pattern results in an error because the ttl parameter is not recognized in the actual implementation.

Usage Example (from README or common usage):

ttl_config = {
    "default_ttl": 1,  # TTL in minutes
    "refresh_on_read": False,  # Do not refresh TTL on read
}

async with AsyncRedisSaver.from_conn_string(
    REDIS_URL,
    ttl=ttl_config
) as memory:
    logger.info(f"redis ttl : {ttl_config['default_ttl']} min")
    await memory.asetup()

TypeError: AsyncRedisSaver.from_conn_string() got an unexpected keyword argument 'ttl'

@classmethod
    @asynccontextmanager
    async def from_conn_string(
        cls,
        redis_url: Optional[str] = None,
        *,
        redis_client: Optional[AsyncRedis] = None,
        connection_args: Optional[dict[str, Any]] = None,
    ) -> AsyncIterator[AsyncRedisSaver]:
        async with cls(
            redis_url=redis_url,
            redis_client=redis_client,
            connection_args=connection_args,
        ) as saver:
            yield saver

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions