Issue #21 duplicate

Custom Serializer ?

jvanasco
created an issue

As I look at expanding a project with increasing components ( Pyramid Web + Twisted Daemons + (sadly) PHP ), interoperability is becoming a bit of a concern.

Looking through the backends:

file.py

  • serializes - util.pickle.dumps(value)
  • deserialze - util.pickle.loads(value)
  • [ util.pickle is cPickle or pickle ]

memcached.py

  • serializes & deserialize are handled within the various 3rd party modules ( largely pickle )

memory

  • native storage

redis.py

  • serializes - pickle.dumps(value)
  • deserialze - pickle.loads(value)
  • [ pickle is dogpile.cache.util's pickle ]

Would you consider a patch that does the following:

  • CacheRegion accepts a 'SerializationAPI' object
  • the SerializationApi has two methods - serialize and deserialize
  • the 'SerializationApi' defaults to the current behavior ( pickle )
  • one could create a custom scheme and pass it in ( ie, json or something else )

While I don't think this would do much for the memcached libraries ( though some are looking at the same custom serialization options ), it would allow the file-backed dbm/ndbm and redis backends to be more interoperable.

Comments (4)

  1. Mike Bayer repo owner

    lets move over to #18. For serialization, the API is a loads()/dumps() function call, probably passed as any object/module that has "loads"/"dumps" available - even a named tuple. Using ObjectsWithUpperCaseNames is way too zopey for this.

  2. Log in to comment