addValue method

void addValue(
  1. String key,
  2. String value,
  3. int expired
)

Adding a value to the memory with an expired time. key The key. value The value. expired The expired time. The unit is ms.

Implementation

void addValue(String key, String value, int expired) {
  if (orderList.length >= maxCacheSize) {
    _removeOldest();
  }

  orderList.add(key);

  store[key] = (value: value, expired: expired);
}