python - redis-py pipeline hset not saving -


i have set pipeline on redis-py save 2 diferent hashes

p = self.app.redis.pipeline() key_id = '{}{}'.format(self.prefix,article.id) key_url = '{}{}'.format(self.prefix,article.url)  # add common fields articlemodel p.hset(key_id, 'shorturl', shorturl) p.hset(key_url,'shorturl', shorturl) k in article.__table__.columns:     k = k.name     if k not in ['url','id']:         p.hset(key_id, k, article.__getattribute__(k))         p.hset(key_url, k, article.__getattribute__(k))  # add different fields , finish transaction p.hset(key_id, 'url', article.url) p.hset(key_url, 'id', article.id) p.expireat(key_id, self.expiration_window) p.expireat(key_url, self.expiration_window) p.execute() 

the pipeline before executing is:

[(('hset', 'article/1', 'shorturl', 'qp'), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'shorturl', 'qp'), {}), (('hset', 'article/1', 'title', u'full pytest documentation'), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'title', u'full pytest documentation'), {}), (('hset', 'article/1', 'authors', u''), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'authors', u''), {}), (('hset', 'article/1', 'html', u'<p>enter search terms or module, class or function name.</p>\n'), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'html', u'<p>enter search terms or module, class or function name.</p>\n'), {}), (('hset', 'article/1', 'plaintext', u'enter search terms or module, class or function name.  '), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'plaintext', u'enter search terms or module, class or function name.  '), {}), (('hset', 'article/1', 'markdown', u'enter search terms or module, class or function name.\n\n'), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'markdown', u'enter search terms or module, class or function name.\n\n'), {}), (('hset', 'article/1', 'date', datetime.datetime(2014, 12, 5, 19, 2, 30, 752183)), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'date', datetime.datetime(2014, 12, 5, 19, 2, 30, 752183)), {}), (('hset', 'article/1', 'url', u'http://pytest.org/latest/contents.html'), {}), (('hset', 'article/http://pytest.org/latest/contents.html', 'id', 1), {}), (('expireat', 'article/1', 604800), {}), (('expireat', 'article/http://pytest.org/latest/contents.html', 604800), {})] 

and answer is:

[1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, true, true] 

so seems saving 16 keys.

when executing self.app.redis.keys('*') not bring key nor when executing self.app.redis.hget('article/1')

any thing missing?

found problem

basically expiration window considering 7 days, not now. beginning of time, around 1970...


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -