sql >> Database >  >> NoSQL >> Redis

hoe kan ik oneindig doorgeven aan redis van python?

Dit is mijn code is getest:

import unittest

from redis import Redis


class RedisTest(unittest.TestCase):

    def setUp(self):
        self.redis = Redis()

    def test_zrangebyscore(self):
        r = self.redis
        name = 'myset'
        r.zadd(name, 'one', 1)
        r.zadd(name, 'two', 2)
        r.zadd(name, 'three', 3)
        r.zadd(name, 'four', 4)

        self.assertTrue(r.zrangebyscore(name, '-inf', '+inf') == ['one', 'two', 'three', 'four'])
        self.assertTrue(r.zrangebyscore(name, 1, 1) == ['one'])
        self.assertTrue(r.zrangebyscore(name, 1, 2) == ['one', 'two'])
        self.assertTrue(r.zrangebyscore(name, 2, 3) == ['two', 'three'])
        self.assertTrue(r.zrangebyscore(name, '(1', '(2') == [])
        self.assertTrue(r.zrangebyscore(name, '(1', '(3') == ['two'])



  1. Mongoimport gebruiken om csv . te importeren

  2. MySQL-export naar MongoDB

  3. MongoDB updateMany()

  4. Wat is het __v-veld in Mongoose