save, return old value. todo: make the expire() atomic with a redis script

def saveget(self,con):
    "save, return old value. todo: make the expire() atomic with a redis script"
    k,v=self.kv()
    oldv=con.getset(k,v)
    if self.TTL is not None: con.expire(k,self.TTL)
    return None if oldv is None else msgpack.loads(oldv)