コード例 #1
0
    def _simulate_local(self, records, cache_local_mb, f):
        from relstorage.cache.local_client import LocalClient
        options = MockOptions()
        options.cache_local_mb = cache_local_mb
        options.cache_local_compression = 'none'
        client = LocalClient(options)

        now = time.time()
        for record in records:
            key = record.lba

            if record.opcode == 'r':
                data = client.get(key)
                if data is None:
                    # Fill it in from the backend
                    client.set(key, b'r' * record.size)
            else:
                assert record.opcode == 'w'
                client.set(key, b'x' * record.size)

        done = time.time()
        stats = client.stats()
        self._report_one(stats, f, cache_local_mb, now, done)

        return stats
コード例 #2
0
    def _simulate_local(self, records, cache_local_mb, f):
        from relstorage.cache.local_client import LocalClient
        options = MockOptions()
        options.cache_local_mb = cache_local_mb
        options.cache_local_compression = 'none'
        client = LocalClient(options)

        now = time.time()
        for record in records:
            key = record.lba

            if record.opcode == 'r':
                data = client.get(key)
                if data is None:
                    # Fill it in from the backend
                    client.set(key, b'r' * record.size)
            else:
                assert record.opcode == 'w'
                client.set(key, b'x' * record.size)

        done = time.time()
        stats = client.stats()
        self._report_one(stats, f, cache_local_mb, now, done)

        return stats
コード例 #3
0
 def populate_empty():
     c = LocalClient(options)
     for k, v in ALL_DATA:
         c.set(k, v)
コード例 #4
0
 def populate_empty():
     c = LocalClient(options)
     for k, v in ALL_DATA:
         c.set(k, v)