Source code for lmcache.experimental.storage_backend.naive_serde.naive_serde
from lmcache.experimental.memory_management import MemoryObj
from lmcache.experimental.storage_backend.naive_serde.serde import (
Deserializer, Serializer)
[docs]
class NaiveSerializer(Serializer):
def __init__(self, memory_allocator):
self.memory_allocator = memory_allocator
[docs]
def serialize(self, memory_obj: MemoryObj) -> MemoryObj:
self.memory_allocator.ref_count_up(memory_obj)
return memory_obj
[docs]
class NaiveDeserializer(Deserializer):
[docs]
def deserialize(self, memory_obj: MemoryObj) -> MemoryObj:
return memory_obj