killme2008 / killme2008/xmemcached

Support kotlinx.serialization

Open
#137 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
764
Forks
271
PR merge metrics
No merged PRs in 30d

Description

Hi, Since Spring Framework 5.3 supports Kotlinx.serialization, I am actively using it in my project. ([Reference Link](https://docs.spring.io/spring-framework/docs/current/reference/html/languages.html#kotlin-multiplatform-serialization))

I tested it by applying Kotlinx.Serialization, but it didn't work.
```Kotlin
@Serializable
data class UserDto (
val id: Long,
val name: String,
val roleCode: String
)
```

```
"exception" : {
"name" : "java.lang.IllegalArgumentException",
"message" : "Non-serializable object",
"stackTrace" : {
"at" : [
"net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder.serialize(BaseSerializingTranscoder.java:93)",
"net.rubyeye.xmemcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:199)",
"net.rubyeye.xmemcached.command.text.TextStoreCommand.encodeValue(TextStoreCommand.java:185)",
"net.rubyeye.xmemcached.command.text.TextStoreCommand.encode(TextStoreCommand.java:145)",
"net.rubyeye.xmemcached.impl.MemcachedTCPSession.wrapMessage(MemcachedTCPSession.java:174)",
"com.google.code.yanf4j.core.impl.AbstractSession.write(AbstractSession.java:370)",
"net.rubyeye.xmemcached.impl.MemcachedConnector.send(MemcachedConnector.java:504)",
"net.rubyeye.xmemcached.XMemcachedClient.sendCommand(XMemcachedClient.java:318)",
"net.rubyeye.xmemcached.XMemcachedClient.sendStoreCommand(XMemcachedClient.java:2343)",
"net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1252)",
"net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1306)",
"net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1295)",
"io.sixhours.memcached.cache.XMemcachedClient.set(XMemcachedClient.java:61)",
"io.sixhours.memcached.cache.MemcachedCache.put(MemcachedCache.java:108)",
```

As a result of debugging, it was confirmed that SerializingTranscoder is the Default Transcoder of the module.

Is there any other way to apply Kotlin serialization? I would be grateful if you could guide me.
Please also check out review of Kotlin serialization support.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading SerializingTranscoder and BaseSerializingTranscoder, which appear in the reported stack trace, alongside the linked Spring Kotlin serialization reference. Determine how Kotlinx.serialization could be applied to XMemcached's default transcoder and verify storing and retrieving the shown UserDto; done means the non-serializable-object error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.