Basic

Storage as a keyed area

A page is thrown away on reload. Storage that lives in the page is thrown away too, and the area is why a choice survives.

What you will see

refuse secret stored. A store is read by a reader.

About 1 min of reading

Try It

Prove a store survives

1

Name the area

printf 'area=mysite\n' > /tmp/a.txt; cat /tmp/a.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One name. One name is what keeps two extensions apart.
2

List the keys

printf 'hidden\nhidden\nhidden\n' | sort -u | wc -l

Before you run it, say out loud what it will print. Then open the answer.

What it prints
1. A list is what a reader checks for a key never set.
3

Refuse a secret

printf 'key=token\n' | awk '{print ($1=="key") ? "refuse secret stored" : "ok"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
refuse secret stored. A store is read by a reader.

Data Flow

A choice to a surviving area
1 The area is named by the extension
↓
2 The keys are written as a list
↓
3 A choice is written to a key
↓
4 A reload reads the same area
Why this works
Why the area is outside the page

Outside is what survives. Surviving is the claim, and surviving is what a reload test proves.

The one thing never stored

A secret. A secret in a store is a secret a reader of the store can read.

Examples

The area is named by the extension

One name for one extension. One name is what makes two extensions not overwrite each other.

The key is written

The key is a name in a list. A list is what a reader checks for a key that was never set.

The page is never the store

A page is a place a reader changes. A store that is a page is a store that can be changed by the page.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← A style as a class, never inline
Previous Lesson
A style as a class, never inline
Next Lesson
The extension answers with a report
The extension answers with a report →