Skip to content

Commit

Permalink
optimize redis entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Snawoot committed Mar 30, 2019
1 parent 6380e69 commit 5e59ced
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postfix_mta_sts_resolver/redis_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def pack_entry(entry):
ts, pol_id, pol_body = entry
obj = dict(pol_id=pol_id, pol_body=pol_body)
obj = (pol_id, pol_body)
# add unique seed to entry in order to avoid set collisions
# and use ZSET two-index table
packed = uuid.uuid4().bytes + json.dumps(obj).encode('utf-8')
Expand All @@ -20,7 +20,7 @@ def pack_entry(entry):
def unpack_entry(packed):
bin_obj = packed[16:]
obj = json.loads(bin_obj.decode('utf-8'))
pol_id, pol_body = obj['pol_id'], obj['pol_body']
pol_id, pol_body = obj
return CacheEntry(ts=0, pol_id=pol_id, pol_body=pol_body)


Expand Down

0 comments on commit 5e59ced

Please sign in to comment.