LRU

Technology & Computing abbreviation · Programming

LRU
Stands forLeast recently used
CategoriesTechnology & Computing

LRU stands for Least recently used, a programming abbreviation.

A cache eviction policy that discards the item not accessed for the longest time when space runs out, on the theory that recent use predicts future use. Operating systems, CPUs, databases and libraries such as Python's functools.lru_cache use it.

Example: Decorate the function with @lru_cache(maxsize=1024) so repeated lookups skip the database.

Usage notes

A classic implementation combines a hash map with a doubly linked list so lookups and updates take constant time, a favorite interview problem. Alternatives include LFU (least frequently used) and FIFO eviction. Redis offers approximate LRU eviction to save memory.

More programming abbreviations

  • LGTM – Looks good to me
  • LIFO – Last in, first out
  • LINQ – Language Integrated Query
  • Lisp – List processing
  • LLVM – LLVM (originally Low Level Virtual Machine)
  • LOC – Lines of code
  • MATLAB – Matrix Laboratory
  • mkdir – Make directory
  • MQ – Message queue
  • MR – Merge request
  • MVC – Model-view-controller
  • MVVM – Model-view-viewmodel

See all 154 programming abbreviations →