Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Expires support for OpenDAL #5623

Open
Xuanwo opened this issue Feb 12, 2025 · 6 comments
Open

Add Expires support for OpenDAL #5623

Xuanwo opened this issue Feb 12, 2025 · 6 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Feb 12, 2025

Hi, OpenDAL currently doesn't support this. One possible approach might be to add Expires support, we can translate Expires to ttl internally for redis.

Originally posted by @Xuanwo in #5622 (comment)


Users can write data like op.write_with(key).expires(time).await.

@Xuanwo Xuanwo added good first issue Good for newcomers help wanted Extra attention is needed labels Feb 12, 2025
@tisonkun
Copy link
Member

How are Expires mapped to other services, e.g., S3?

@kaplanelad
Copy link

Thanks, @Xuanwo!
I'm planning to add Redis cache support to Loco.

@Xuanwo
Copy link
Member Author

Xuanwo commented Feb 13, 2025

How are Expires mapped to other services, e.g., S3?

Expires is part of the HTTP standards, so S3 also supports Expires: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax

However, its behavior is related to client-side caching:

The date and time at which the object is no longer cacheable. For more information, see https://www.rfc-editor.org/rfc/rfc7234#section-5.3.

The HTTP Expires response header contains the date/time after which the response is considered expired in the context of HTTP caching.

@kaplanelad
Copy link

@Xuanwo I'd like to take this on.
Could you share your vision for the implementation? There is some example of this on another cache provider?

@kaplanelad
Copy link

@Xuanwo?

@Xuanwo
Copy link
Member Author

Xuanwo commented Feb 21, 2025

Hi @kaplanelad, I have taken this feature into consideration for a while and think we can approve it this way.

Public API

op.write_with(path).expires(duration).await

Raw API

  • Add expires: Duration in OpWrite.
  • Add write_with_expires in Capability

At current time, we only need to support services that will really expire keys like redis and memcache.

And I feel like it's the time to implmenet redis support without the kv adapter. Many new features can be added in redis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants