1Storable(3) User Contributed Perl Documentation Storable(3)
2
3
4
6 Coro::Storable - offer a more fine-grained Storable interface
7
9 use Coro::Storable;
10
12 This module implements a few functions from the Storable module in a
13 way so that it cede's more often. Some applications (such as the
14 Deliantra game server) sometimes need to load large Storable objects
15 without blocking the server for a long time.
16
17 This is being implemented by using a perlio layer that feeds only small
18 amounts of data (4096 bytes per call) into Storable, and
19 "Coro::cede"'ing regularly (at most 100 times per second by default,
20 though).
21
22 As Storable is not reentrant, this module also wraps most functions of
23 the Storable module so that only one freeze or thaw is done at any one
24 moment (and recursive invocations are not currently supported).
25
27 $ref = thaw $pst
28 Retrieve an object from the given $pst, which must have been
29 created with "Coro::Storable::freeze" or
30 "Storable::store_fd"/"Storable::store" (sorry, but Storable uses
31 incompatible formats for disk/mem objects).
32
33 This function will cede regularly.
34
35 $pst = freeze $ref
36 Freeze the given scalar into a Storable object. It uses the same
37 format as "Storable::store_fd".
38
39 This functino will cede regularly.
40
41 $pst = nfreeze $ref
42 Same as "freeze" but is compatible to "Storable::nstore_fd" (note
43 the "n").
44
45 $pst = blocking_freeze $ref
46 Same as "freeze" but is guaranteed to block. This is useful e.g. in
47 "Coro::Util::fork_eval" when you want to serialise a data structure
48 for use with the "thaw" function for this module. You cannot use
49 "Storable::freeze" for this as Storable uses incompatible formats
50 for memory and file images, and this module uses file images.
51
52 $pst = blocking_nfreeze $ref
53 Same as "blocking_freeze" but uses "nfreeze" internally.
54
55 $guard = guard
56 Acquire the Storable lock, for when you want to call Storable
57 yourself.
58
59 Note that this module already wraps all Storable functions, so
60 there is rarely the need to do this yourself.
61
63 Marc A. Lehmann <schmorp@schmorp.de>
64 http://software.schmorp.de/pkg/Coro.html
65
66
67
68perl v5.34.0 2021-07-22 Storable(3)