Skip to content

Configurable TTL for the targeting cache (default 24 hours) - #45

Merged
mosherBT merged 2 commits into
Optable:masterfrom
postindustria-tech:feature/configurable-ttl
Aug 13, 2026
Merged

Configurable TTL for the targeting cache (default 24 hours)#45
mosherBT merged 2 commits into
Optable:masterfrom
postindustria-tech:feature/configurable-ttl

Conversation

@Riabkov

@Riabkov Riabkov commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Closes #42

OptableConfig.kt:

  • Add cacheTtl parameter and DEFAULT_TARGETING_CACHE_TTL_SECONDS 24h constant.
    LocalStorage.kt:
  • Added targetingTimestampKey and targetingCacheTtlMs
  • Save cache timestamp on every setTargeting
  • Check if cache expired before returning getTargeting() result
  • Clear cache timestamp alongside cache in clearTargeting()
    OptableSDK.kt:
  • Extended targetingFromCache() KDoc to reflect TTL changes
    Docs:
  • Updated README.md with updated cache mechanics
    Tests:
  • Added tests for cache expiration
  • Updated OptableConfigTest.kt

Comment thread README.md
@mosherBT

Copy link
Copy Markdown
Contributor

Needs rebase from other PR merges

Riabkov and others added 2 commits August 12, 2026 14:33
- Add cacheTtl parameter and DEFAULT_TARGETING_CACHE_TTL_SECONDS 24h constant.
LocalStorage.kt:
- Added targetingTimestampKey and targetingCacheTtlMs
- Save cache timestamp on every setTargeting
- Check if cache expired before returning getTargeting() result
- Clear cache timestamp alongside cache in clearTargeting()
OptableSDK.kt:
- Extended targetingFromCache() KDoc to reflect TTL changes
Docs:
- Updated README.md with updated cache mechanics
Tests:
- Added tests for cache expiration
- Updated OptableConfigTest.kt
The negative-age guard for a device clock that moved backwards had no
coverage, though the iOS SDK tests the equivalent case.
@Riabkov
Riabkov force-pushed the feature/configurable-ttl branch from 5e0b8b2 to 9a726b6 Compare August 12, 2026 11:35
@Riabkov
Riabkov requested review from a team as code owners August 12, 2026 11:35
@mosherBT
mosherBT merged commit 866071f into Optable:master Aug 13, 2026
3 checks passed
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.

Configurable TTL for the targeting cache (default 24 hours)

4 participants