(self, db)
return success
Save the object to Redis.
Save the object to Redis.
Save the object to Redis .
async def save(self, db):
        """Save the object to Redis.
        """
        kwargs = {}
        for col in self._auto_columns:
            if not self.has_real_data(col.name):
                kwargs[col.name] = await col.auto_generate(db, self)
        self.__dict__.update(kwargs)

        # we have to delete the old index key
        stale_object = await self.__class__.load(db, identifier=self.identifier())
        d = {
            k: (v.strftime(DATETIME_FORMAT) if isinstance(v, datetime) else v)
            for k, v in self.__dict__.items()
        }
        success = await db.hmset_dict(self.redis_key(), d)
        await self.save_index(db, stale_object=stale_object)
        return success
async def save ( self , db ) : kwargs = { } for col in self . _auto_columns : if not self . has_real_data ( col . name ) : kwargs [ col . name ] = await col . auto_generate ( db , self ) self . __dict__ . update ( kwargs ) # we have to delete the old index key stale_object = await self . __class__ . load ( db , identifier = self . identifier ( ) ) d = { k : ( v . strftime ( DATETIME_FORMAT ) if isinstance ( v , datetime ) else v ) for k , v in self . __dict__ . items ( ) } success = await db . hmset_dict ( self . redis_key ( ) , d ) await self . save_index ( db , stale_object = stale_object ) return success