mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(feeds): add scheduled cleanup (#1073)
* refactor(feeds): make feed scheduling more robust * feat(feeds): add daily cleanup job * removes feed cache older than 30 days * fix(feeds): fmt wrong type
This commit is contained in:
parent
cfc2436d50
commit
6fd8626507
11 changed files with 301 additions and 215 deletions
|
@ -9,13 +9,14 @@ import (
|
|||
)
|
||||
|
||||
type FeedCacheRepo interface {
|
||||
Get(bucket string, key string) ([]byte, error)
|
||||
GetByBucket(ctx context.Context, bucket string) ([]FeedCacheItem, error)
|
||||
GetCountByBucket(ctx context.Context, bucket string) (int, error)
|
||||
Exists(bucket string, key string) (bool, error)
|
||||
Put(bucket string, key string, val []byte, ttl time.Time) error
|
||||
Delete(ctx context.Context, bucket string, key string) error
|
||||
DeleteBucket(ctx context.Context, bucket string) error
|
||||
Get(feedId int, key string) ([]byte, error)
|
||||
GetByFeed(ctx context.Context, feedId int) ([]FeedCacheItem, error)
|
||||
GetCountByFeed(ctx context.Context, feedId int) (int, error)
|
||||
Exists(feedId int, key string) (bool, error)
|
||||
Put(feedId int, key string, val []byte, ttl time.Time) error
|
||||
Delete(ctx context.Context, feedId int, key string) error
|
||||
DeleteByFeed(ctx context.Context, feedId int) error
|
||||
DeleteStale(ctx context.Context) error
|
||||
}
|
||||
|
||||
type FeedRepo interface {
|
||||
|
@ -79,7 +80,7 @@ const (
|
|||
)
|
||||
|
||||
type FeedCacheItem struct {
|
||||
Bucket string `json:"bucket"`
|
||||
FeedId string `json:"feed_id"`
|
||||
Key string `json:"key"`
|
||||
Value []byte `json:"value"`
|
||||
TTL time.Time `json:"ttl"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue