# ol.clave.acme.impl.directory-cache

Global directory cache with TTL for ACME directory responses.

ACME directories rarely change, so caching them avoids unnecessary network
requests for long-running servers managing many domains.

The cache is keyed by directory URL with a 12-hour default TTL.
Stale entries remain until replaced (no background cleanup).

## default-ttl-ms

Default TTL of 12 hours in milliseconds.

[source,window=_blank](https://github.com/outskirtslabs/clave/blob/main/src/ol/clave/acme/impl/directory_cache.clj#L10-L12)

---

## cache-get

```clojure
(cache-get url)
(cache-get url ttl-ms)
```

Returns cached directory for url if present and fresh, else nil.

[source,window=_blank](https://github.com/outskirtslabs/clave/blob/main/src/ol/clave/acme/impl/directory_cache.clj#L25-L31)

---

## cache-put

```clojure
(cache-put url directory)
```

Stores directory in cache with current timestamp. Returns directory.

[source,window=_blank](https://github.com/outskirtslabs/clave/blob/main/src/ol/clave/acme/impl/directory_cache.clj#L33-L38)

---

## cache-clear

```clojure
(cache-clear)
```

Clears entire directory cache. Useful for testing.

[source,window=_blank](https://github.com/outskirtslabs/clave/blob/main/src/ol/clave/acme/impl/directory_cache.clj#L40-L43)

---

## cache-evict

```clojure
(cache-evict url)
```

Removes single entry from cache.

[source,window=_blank](https://github.com/outskirtslabs/clave/blob/main/src/ol/clave/acme/impl/directory_cache.clj#L45-L48)
