Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add TTLMiddleware for automatic document expiration (#599)#600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Anuradha-Agrawal-07 wants to merge1 commit intomsiemens:master
base:master
Choose a base branch
Loading
fromAnuradha-Agrawal-07:ttl-middleware-feature

Conversation

@Anuradha-Agrawal-07
Copy link

This pull request introduces TTLMiddleware, a new middleware for TinyDB that enables automatic expiration of documents based on TTL (time-to-live) semantics. Documents can specify expiration using either:

_ttl: number of seconds before expiration from insertion time,

_expires_at: explicit Unix timestamp indicating expiration.

Key features include:

Expired documents are automatically excluded from query results, ensuring they appear as if removed.

A purge_expired() method that allows manual cleanup of expired documents from the storage.

Complete test coverage verifying correct filtering, purging, and TTL behavior.

Documentation additions in usage.rst outlining how to use the TTL middleware with code examples and notes on caching.

This feature addresses issue#599 to enable native document TTL support within TinyDB.

All tests pass locally with pytest including coverage measurements.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@Anuradha-Agrawal-07

[8]ページ先頭

©2009-2025 Movatter.jp