Thread
#serialization
    b

    benkuly

    4 months ago
    Are there plans to support suspending serialize/deserialize? I need to make a database/cache call within deserialize to determine which
    DeserializationStrategy
    should be used depending on a field value.
    n

    Norbi

    4 months ago
    I think that it's better to build a cache in memory. Or simply use blocking code to query the database.
    Dominaezzz

    Dominaezzz

    4 months ago
    Cache in memory is definitely better but it still seems like an odd thing to do.
    What are you actually deserializing?
    b

    benkuly

    4 months ago
    I want to deserilize the different PDUs of the Matrix spec. The room version needs to be looked up in a database using the
    room_id
    . To circumvent it, I think I try to detect the PDUs room version depending on the presence of the
    event_id
    .
    Dominaezzz

    Dominaezzz

    4 months ago
    For stuff like I'd do two step serialisation. One to get the PDU with JSON then another to deserialise the JSON once I've done the database lookup.
    b

    benkuly

    4 months ago
    I just asked in the matrix community and it seems, that holding the room versions of the room ids in memory is the usual approach here...
    Dominaezzz

    Dominaezzz

    4 months ago
    There's another issue somewhere where the team decided not to support suspending as it would be too expensive for most cases.
    Ah fair enough that works. All for the sake of type safety.