enableCache method

void enableCache({
  1. int maxSize = 1024,
})
inherited

Enables the use of a cache to eliminate the overhead of consecutive resolutions of the same path.

The cache holds at most maxSize results, evicting the least recently used: its keys are request paths, so without a bound, distinct paths (e.g. /users/1, /users/2) would grow it indefinitely. A maxSize of 0 or less disables caching.

Implementation

void enableCache({int maxSize = 1024}) {
  _useCache = true;
  _maxCacheSize = maxSize;
}