Skip to content

Custom serializer/codec for redis-strings - extension for compression/encryption #191

@m-sanders

Description

@m-sanders

The Redis cache handler stores Next.js cache values as uncompressed JSON, wasting 2.5-10x more memory than necessary. Serialization is hardcoded in redis-strings.ts with no way to add compression, encryption, or custom formats.

My ideas is to:

Implement a pluggable serializer system with:

  • Strategy pattern for serialization/deserialization
  • defaultSerializer - no compression (backward compatible)
  • gzipSerializer - 60-85% size reduction
  • Extensible CacheSerializer interface for custom implementations

Impact

Reduces Redis memory usage and infrastructure costs while enabling customization for compression algorithms, encryption, or specialized formats.

I am happy to look at implementing.

(EDIT: I stupidly opened the wrong issue for this repo as I mixed up tabs 😬 )

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions