(obj)
| 43 | |
| 44 | |
| 45 | def serialize_item(obj): |
| 46 | if isinstance(obj, list): |
| 47 | return [serialize_item(x) for x in obj] |
| 48 | |
| 49 | if isinstance(obj, KVCacheItem): |
| 50 | return { |
| 51 | "id": obj.id, |
| 52 | "metadata": obj.metadata, |
| 53 | "records": obj.records.model_dump() |
| 54 | if hasattr(obj.records, "model_dump") |
| 55 | else obj.records, |
| 56 | "memory": get_cache_info(obj.memory), |
| 57 | } |
| 58 | |
| 59 | if isinstance(obj, DynamicCache): |
| 60 | return get_cache_info(obj) |
| 61 | |
| 62 | return str(obj) |
| 63 | |
| 64 | |
| 65 | if __name__ == "__main__": |
no test coverage detected