コード例 #1
0
ファイル: cachesize_tests.py プロジェクト: erotavlas/lrucache
def test_reset():
    """Put some items in cache, then clear it => size == 0"""
    lru = LRUCache(10)

    for i in range(0, 10):
        lru.put(i, str(i))

    lru.reset()

    assert lru.currentsize == 0
コード例 #2
0
from lru_cache.LRUCache import LRUCache

"""
This file was used for debugging the LRUCache
"""

if __name__ == '__main__':
    
    lru = LRUCache(3)
    
    for i in range(0,3):
        lru.put(i, str(i)) 
    
    print(lru._printForward())

    lru.reset()

    lru.put(0, 'a')
    lru.put(1, 'b')
    lru.put(2, 'c')

    print(lru._printForward())

    lru.get(1)
    #lru.reset()

    lru.put(1, 'a')
    
    print(lru._printForward())
    print("-")