Skip to content

Implement Cacher Interface and FileCacher Structure #4

@piraz

Description

@piraz

Establish a dedicated cache package to decouple storage logic from the protocol. This includes a generic Cacher interface to allow for future storage implementations (e.g., memory or database) and a FileCacher for local filesystem persistence.

Tasks

  • Create internal/cache/cacher.go.
  • Define the Cacher interface with Get, Set, and IsExpired methods.
  • Implement the FileCacher struct and its logic.
  • Ensure thread-safe directory creation and file permissions.

Acceptance Criteria

  • The cache package is independent of the protocol package.
  • FileCacher correctly persists strings to the disk.
  • TTL is respected when checking for cache validity.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions