[ Non-logical Variables, Arrays, Bags, Shelves and Stores | The ECLiPSe Built-In Predicates | 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

- store_erase(+) is det

### 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) record 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'(16'002f4da0)
        Data1 = [key - value]
        N1 = 1
        Data2 = []
        N2 = 0
        Yes (0.00s cpu)

## See Also

store / 1, local / 1, store_set / 3, store_get / 3, store_delete / 2, store_contains / 2, stored_keys / 2, stored_keys_and_values / 2, store_create / 1, store_count / 2