Skip to content

Add TTL/Expiration, Increment/Decrement, and Pub/Sub to Cache service #64

Description

@NitinKumar004

Summary

The Cache driver interface only has basic Set/Get/Delete/Keys/FlushAll. It's missing TTL expiration, atomic counters, and pub/sub — the most fundamental Redis features.

What's Missing

TTL / Expiration

  • SetWithTTL (set key with expiration)
  • GetTTL / SetTTL / Persist (manage key expiration)
  • Expired key auto-cleanup

Atomic Counters

  • Incr / Decr / IncrBy / DecrBy
  • IncrByFloat

Pub/Sub

  • Subscribe / Unsubscribe / Publish
  • PSubscribe (pattern-based)

Data Structures (stretch)

  • LPush / RPush / LPop / RPop / LRange (Lists)
  • SAdd / SRem / SMembers / SIsMember (Sets)
  • HSet / HGet / HDel / HGetAll (Hashes)

Provider Mapping

Feature AWS ElastiCache Azure Cache for Redis GCP Memorystore
TTL EXPIRE/TTL EXPIRE/TTL EXPIRE/TTL
Counters INCR/DECR INCR/DECR INCR/DECR
Pub/Sub Pub/Sub Pub/Sub Pub/Sub

Why This Matters

Acceptance Criteria

  • Add TTL, counter, and pub/sub methods to cache/driver/driver.go
  • Implement in all 3 providers (ElastiCache, Azure Redis, Memorystore)
  • TTL expiration should work with FakeClock for deterministic testing
  • Add tests covering all 3 providers

Metadata

Metadata

Assignees

No one assigned

    Labels

    awsAmazon Web ServicesazureMicrosoft AzureenhancementNew feature or requestgcpGoogle Cloud Platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions