[ Non-logical Variables, Arrays, Bags, Shelves and Stores | Reference Manual | Alphabetic Index ]

store_erase(+StoreHandle)

Erase the contents of the specified store object
StoreHandle
A store handle or store name

Description

This erases the contents of the store object and frees the associated memory. The store object itself remains valid and is equivalent to a newly created store.

Note that anonymous stores (which are referred to by handle rather than name) are automatically erased and destroyed when their handle gets garbage collected, or when failing across their creation point.

On the other hand, named stores should be explicitly erased, otherwise their contents will continue to occupy memory.

Calling store_erase/1 is equivalent to deleting every entry in the store via store_delete/2.

Note: If StoreHandle is not a handle, then it must be an atom or a compound term, and the store is identified by this term's toplevel functor together with the context module. .

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
StoreHandle is uninstantiated
(5) type error
StoreHandle is neither atom nor compound term nor store handle
(45) named object does not exist
StoreHandle is not the name of a store

Examples


    ?- store_create(Handle),
       store_set(Handle, key, value),
       stored_keys_and_values(Handle, Data1),
       store_count(Handle, N1),
       store_erase(Handle),
       stored_keys_and_values(Handle, Data2),
       store_count(Handle, N2).

    Handle = $&(store,"17h3")
    Data1 = [key - value]
    N1 = 1
    Data2 = []
    N2 = 0
    Yes (0.00s cpu)
    

See Also

store / 1, store_create / 1, store_count / 2, store_delete / 2, store_remove / 3