Skip to content

TBD: feat: add generic serializer impl#302

Open
yikakia wants to merge 1 commit into
eko:masterfrom
yikakia:feat/serializer
Open

TBD: feat: add generic serializer impl#302
yikakia wants to merge 1 commit into
eko:masterfrom
yikakia:feat/serializer

Conversation

@yikakia

@yikakia yikakia commented Feb 3, 2026

Copy link
Copy Markdown

To address the issue in #72 #72 (comment), a generic Marshaler implementation has been added.

Outstanding tasks:

  • Test cases for Serializer
  • Compatibility tests with Loadable

Items for discussion:

  1. Should Marshaler be directly replaced instead of creating a new Serializer?
  2. The original implementation supported both []byte and string types; is continued support necessary?
  3. Are the parameters for this constructor method appropriate?
  4. Design question: Should the StoreInterface itself determine whether to serialize? After CacheInterface supports generics, users would expect to directly retrieve the corresponding object T, rather than concerning themselves with how object T is converted into the format supported by each StoreInterface, or how to deserialize from the string or []byte returned by each StoreInterface back into object T.

Translated from chinese
为了解决 #72 中的问题 #72 (comment) 增加泛型的 Marshaler 实现

未完成的工作:

  • Serializer 的测试用例
  • 与 Loadable 的兼容性测试

待讨论项:

  1. 是否应直接替换 Marshaler 而非新建一个 Serializer
  2. 原来的实现中兼容了类型为 []byte 和 string 的两种情况,是否需要继续支持
  3. 这个构造方法的参数是否合适
  4. 设计问题:序列化与否是否应该由 StoreInterface 自己决定?CacheInterface 支持泛型后,用户期望的应该是直接能拿到对应的 obj T ,而不是 obj T 怎么转为每个 StoreInterface 支持的格式,怎么从每个 StoreInterface 返回的 string 或 []byte 反序列化回 obj T

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.

1 participant