> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cache

> Cache to often used db tables and structures and retrieve them in a useful and structured fashion

Cache to often used db tables and structures and retrieve them in a useful and structured fashion

## Constructors

### Cache()

```crmscript theme={null}
Cache
```

Initializes a new instance of the Cache class.

## Methods

## eof()

Checks if there are no more fields in the result.

```crmscript theme={null}
Bool eof()
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - True if it is at end of file or there are no more fields to iterate through; otherwise, false.

<Note>
  A common usage is in the condition section in a for loop.
</Note>

## first()

Sets the iterator variable to the first field in the field set.

```crmscript theme={null}
Bool first()
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - False if the field set is empty; otherwise, true.

## getData(String)

This function will return data from a cached table.

```crmscript theme={null}
String getData(String tableId)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Data from the cached table specified in tableId.

## getDataSubset(String,String,String)

Returns a subset of the data for a cached table based on a filter, where a field must have a given value.

```crmscript theme={null}
getDataSubset(String tableId, String filterField, String filterValue)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The rows from the table where filterField = filterValue.

## getRow()

Returns a row of fields.

```crmscript theme={null}
Map getRow()
```

**Returns:** [CRMScript.Native.Map](CRMScript.Native.Map) - A row of fields.

## next()

Sets the iterator to the next field.

```crmscript theme={null}
Bool next()
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - False if at end of file or the field set is empty; otherwise, true.

## sort(String,Bool)

Sorts the cached data by given field in given order.

```crmscript theme={null}
sort(String field, Bool order)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)


## Related topics

- [SuperOffice.WebApi.Data.Cache](/en/api/reference/webapi/SuperOffice.WebApi.Data.Cache.md)
- [Get Cache State](/en/api/reference/restful/agent/diagnostics_agent/get-cache-state.md)
- [Cache Folder List](/en/api/reference/restful/agent/email_agent/cache-folder-list.md)
- [Clear Configuration Cache](/en/api/reference/restful/agent/configuration_agent/clear-configuration-cache.md)
- [Get Cache Names](/en/api/reference/restful/agent/diagnostics_agent/get-cache-names.md)
- [CacheTables table](/en/database/tables/cachetables.md)
