Skip to main content

Storage

Storage

Each persistent class definition includes information that describes how the class properties are to be mapped to the globals in which they are actually stored. The class compiler generates this information for the class and updates it as you modify and recompile.

A Look at a Storage Definition

It can be useful to look at this information, and on rare occasions you might want to change some of the details (very carefully). For a persistent class, your Integrated Development Environment (IDE) displays something like the following as part of your class definition:

<Storage name="Default">
<Data name="PersonDefaultData"><Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Name</Value>
</Value>
<Value name="3">
<Value>SSN</Value>
</Value>
<Value name="4">
<Value>DOB</Value>
</Value>
...
</Storage>

Globals Used by a Persistent Class

The storage definition includes several elements that specify the globals in which the data is stored:

<DataLocation>^Sample.PersonD</DataLocation>
<IdLocation>^Sample.PersonD</IdLocation>
<IndexLocation>^Sample.PersonI</IndexLocation>
...
<StreamLocation>^Sample.PersonS</StreamLocation>

By default, with default storage:

  • The class data is stored in the data global for the class. Its name starts with the complete class name (including package name). A D is appended to the name. For example: Sample.PersonD

  • The index data is stored in the index global for the class. Its name starts with the class name and ends with an I. For example: Sample.PersonI

  • Any saved stream properties are stored in the stream global for the class. Its name starts with the class name and ends with an S. For example: Sample.PersonS

Important:

If the complete class name is long, the system automatically uses a hashed form of the class name instead. So when you view a storage definition, you might sometimes see global names like ^package1.pC347.VeryLongCla4F4AD. If you plan to work directly with the data global for a class for any reason, make sure to examine the storage definition so that you know the actual name of the global.

For more information on how global names are determined, see Globals in Defining and using Classes.

Notes

Note the following points:

  • Never redefine or delete storage for a class that has stored data. If you do so, you will have to recreate the storage manually, because the new default storage created when you next compile the class might not match the required storage for the class.

  • During development, you may want to reset the storage definition for a class. You can do this if you also delete the data and later reload or regenerate it.

  • By default, as you add and remove properties during development, the system automatically updates the storage definition, via a process known as schema evolution.

    The exception is if you use a non-default storage class for the <Type> element. The default is %Storage.Persistent; if you do not use this storage class, InterSystems IRIS does not update the storage definition.

FeedbackOpens in a new tab