xref: /f-stack/app/redis-5.0.5/utils/lru/README (revision 572c4311)
1*572c4311SfengbojiangThe test-lru.rb program can be used in order to check the behavior of the
2*572c4311SfengbojiangRedis approximated LRU algorithm against the theoretical output of true
3*572c4311SfengbojiangLRU algorithm.
4*572c4311Sfengbojiang
5*572c4311SfengbojiangIn order to use the program you need to recompile Redis setting the define
6*572c4311SfengbojiangREDIS_LRU_CLOCK_RESOLUTION to 1, by editing the file server.h.
7*572c4311SfengbojiangThis allows to execute the program in a fast way since the 1 ms resolution
8*572c4311Sfengbojiangis enough for all the objects to have a different enough time stamp during
9*572c4311Sfengbojiangthe test.
10*572c4311Sfengbojiang
11*572c4311SfengbojiangThe program is executed like this:
12*572c4311Sfengbojiang
13*572c4311Sfengbojiang    ruby test-lru.rb /tmp/lru.html
14*572c4311Sfengbojiang
15*572c4311SfengbojiangYou can optionally specify a number of times to run, so that the program
16*572c4311Sfengbojiangwill output averages of different runs, by adding an additional argument.
17*572c4311SfengbojiangFor instance in order to run the test 10 times use:
18*572c4311Sfengbojiang
19*572c4311Sfengbojiang    ruby test-lru.rb /tmp/lru.html 10
20