Skip to content

Commit bbc0e1e

Browse files
committed
add moduledoc for cache
1 parent 996d37a commit bbc0e1e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/scenic/cache.ex

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@
44
#
55
defmodule Scenic.Cache do
66
@moduledoc """
7-
Documentation for ScenicCache.
7+
The Cache module serves several purposes at the same time.
8+
9+
First, static assets such as fonts, images and more tend to be relatively large compared to other data in the system.
10+
It is good to have one place to load and access them for use by multiple scenes and drivers.
11+
12+
Second, the scenes are in control on when things are loaded. However, multiple scenes (across multiple viewports) may
13+
try to load the same assets at the same time. The Cache does it’s best to manage the lifetime of these assets to
14+
minimize memory used and work done to load and unload them.
15+
16+
Finally, the drivers react to the cache as assets are loaded and unloaded. They use a pub/sub interface to get changes
17+
to items in the cache as they come and go.
18+
19+
In addition to the core cache/pub-sub features, the helper modules such as Cache.File, Cache.Hash and Cache.Term
20+
enforce that the files being loaded are the ones the developer intended at build time. This helps reduce an attack
21+
vector on devices and should be used consistently.
822
"""
923
use GenServer
1024

0 commit comments

Comments
 (0)