@@ -0,0 +1,1041 @@
+#!/usr/bin/env python%0A%0Aimport ConfigParser%0Aimport json%0Aimport psycopg2%0Aimport redis%0Aimport time%0A%0A%0Adef main():%0A    config = ConfigParser.RawConfigParser()%0A    config.read(('default.cfg', 'local.cfg',))%0A    db_host = config.get('Database', 'host')%0A    db_user = config.get('Database', 'user')%0A    db_pass = config.get('Database', 'password')%0A%0A    conn = psycopg2.connect(host=db_host, user=db_user, password=db_pass)%0A    rconn = redis.Redis(db='urlencode')%0A    rconn.connect()%0A    try:%0A        cursor = conn.cursor()%0A        cursor.execute('SELECT * FROM urlurlurl')%0A        results = cursor.fetchall()%0A        for result in results:%0A            _id, url, enc, rurl, created, flags = result%0A            created = time.mktime(created.utctimetuple())%0A            # Forward mapping%0A            rconn%5Benc%5D = json.dumps(%7B'url' : url, 'rurl' : rurl, 'created' : created, 'flags' : flags%7D)%0A            # Reverse mapping%0A            rconn%5Burl%5D = enc%0A    finally:%0A        conn.close()%0A        rconn.disconnect()%0A%0Aif __name__ == '__main__':%0A    main()%0A%0A

Add a simple script to prefill Redis with the old postgres data