Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

PStore.new

[unchecked out K = untyped, unchecked out V = untyped] (::path file, ?::boolish thread_safe) -> ::PStore[K, V]
new(file, thread_safe = false)

Returns a new PStore object.

Argument file is the path to the file in which objects are to be stored; if the file exists, it should be one that was written by PStore.

Example
path = 't.store'
store = PStore.new(path)

A PStore object is reentrant. If argument thread_safe is given as true, the object is also thread-safe (at the cost of a small performance penalty):

Example
store = PStore.new(path, true)
See also #[] #[]= also in 3.3 · 3.2 · 3.1 · 3.0