<s> import json <EOL> from redis import StrictRedis <EOL> from mining . db . datawarehouse import GenericDataWarehouse <EOL> class Redis ( GenericDataWarehouse ) : <EOL> search = False <EOL> def conn ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = StrictRedis ( host = self . conf . get ( '<STR_LIT:host>' ) , <EOL> port = self . conf . get ( '<STR_LIT:port>' ) , <EOL> db = int ( self . conf . get ( '<STR_LIT>' ) ) ) <EOL> return conn <EOL> def save ( self , house , data , content_type = "<STR_LIT:application/json>" ) : <EOL> """<STR_LIT>""" <EOL> if content_type == "<STR_LIT:application/json>" : <EOL> return self . conn ( ) . set ( house , json . dumps ( data ) ) <EOL> return self . conn ( ) . set ( house , data ) <EOL> def get ( self , house , content_type = "<STR_LIT:application/json>" , callback = { } , <EOL> filters = [ ] , page = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if content_type == "<STR_LIT:application/json>" : <EOL> return json . loads ( self . conn ( ) . get ( house ) ) or callback <EOL> return self . conn ( ) . get ( house ) or callback </s>
