Skip to content

Conversation

@berndverst
Copy link
Member

@berndverst berndverst commented Aug 7, 2021

Description

Redis unlike other databases that support TTL does not have an option to set a default TTL at the database or table / collection level.

This addition to the Redis State Store component allows defining a default TTL to be used whenever an individual State Store request does not specify a TTL.

Fixes #1060

@berndverst berndverst requested review from a team as code owners August 7, 2021 00:08
@berndverst
Copy link
Member Author

With this PR the component YAML will include a ttlInSeconds option (completely optional) to set a default TTL.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
  namespace: <NAMESPACE>
spec:
  type: state.redis
  version: v1
  metadata:
  - name: redisHost
    value: <HOST>
  - name: redisPassword
    value: <PASSWORD>
  - name: enableTLS
    value: <bool> # Optional. Allowed: true, false.
  - name: failover
    value: <bool> # Optional. Allowed: true, false.
  - name: sentinelMasterName
    value: <string> # Optional
  - name: maxRetries
    value: # Optional
  - name: maxRetryBackoff
    value: # Optional
  - name: ttlInSeconds
    value: <int> # Optional

@codecov
Copy link

codecov bot commented Aug 7, 2021

Codecov Report

Merging #1059 (a773cdd) into master (253ef85) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1059      +/-   ##
==========================================
- Coverage   34.53%   34.53%   -0.01%     
==========================================
  Files         132      132              
  Lines       10870    10882      +12     
==========================================
+ Hits         3754     3758       +4     
- Misses       6736     6744       +8     
  Partials      380      380              
Impacted Files Coverage Δ
state/redis/redis.go 42.22% <33.33%> (-0.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 253ef85...a773cdd. Read the comment docs.

@artursouza artursouza merged commit aa7d2ee into dapr:master Aug 10, 2021
@berndverst berndverst deleted the RedisGlobalTTL branch August 10, 2021 03:05
berndverst added a commit to berndverst/docs that referenced this pull request Aug 10, 2021
This is to document the new global TTL option for Redis
Implemented in dapr/components-contrib#1059 for issue dapr/components-contrib#1060
amimimor pushed a commit to amimimor/components-contrib that referenced this pull request Dec 9, 2021
* Adds Default TTL Option for Redis State Store

* Add additional tests

* Parse correct property key

Co-authored-by: Bernd Verst <me@bernd.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default TTL support for Redis State Store

2 participants