Hi, sorry for late reply on this.
Do you make any changes in config regarding history cache sizes? Specifically settings:
history.cacheInitialSize
default 128
history.cacheMaxSize
default 512
history.eventsCacheInitialSize
default 128
history.eventsCacheMaxSize
default 512
These are per shard configurations, how many history shards do you define for cluster?
Caches items should be cleared if the the limits max size is reached. There is no periodic cache cleaning.
Regarding the error, are you getting resource exhausted errors? If you have server metrics enabled check maybe:
sum(rate(service_errors_resource_exhausted{}[1m])) by (resource_exhausted_cause)