# maxEntitiesToStore

var maxEntitiesToStore: Int

The amount of entities to store in this EntityCache per Entity class.

By default, this value is configured by `DatabaseConfig.maxEntitiesToStoreInCachePerEntity`, which defaults to storing all entities.

On setting a new value, all data stored in the cache will be adjusted to the new size. If the new value is less than the current cache size by N, the first N entities stored will be removed. If the new value is greater than the current cache size, the adjusted cache will only be filled with more entities after they are retrieved, for example by calling EntityClass.all.

#### Samples

org.jetbrains.exposed.v1.tests.shared.entities.EntityCacheTests.changeEntityCacheMaxEntitiesToStoreInMiddleOfTransaction