basic algorithm for least recently used cache