tkem/cachetools

Why cachetools don't copy result before returning it from cache to prevent mutation of cached value?

deniszvyagintsev opened this issue · 1 comments

import pandas as pd
@cached(cache= LRUCache(maxsize= 3))
def some_fun():
    return pd.DataFrame([1, 2, 3])
a = some_fun()
a
   0
0  1
1  2
2  3
a.drop(0, inplace=True)
a
   0
1  2
2  3
some_fun()
   0
1  2
2  3

Found this issue, sorry :)
#184