JCS Disk Cache Problem

I use JCS for caching, and I have a problem when data is not written to disk, i.e. the error does not occur, but when I look at the data files, they are all 0k in size. what causes this error, I am using the properties file provided on the JCS website.

+4
source share
2 answers

Do you know that this is a mistake? Perhaps it writes only to disk when the cache exceeds a certain limit. that is, he is recorded only when he should.

Using Madhu's solution: When jcs.default.cacheattributes.MaxObjects=0 the file size will always be 0. Delete this and you can see the data in the files.

+1
source

One of the cache attributes is DiskUsagePatternName. The value can be SWAP or UPDATE. The default is SWAP. UPDATE immediately writes cache data to disk.

In cache.ccf add the line for

 jcs.region.[yourregionid].cacheattributes.DiskUsagePatternName=UPDATE 

Thus, it will write to disk without having to turn off the cache, and you can still get the benefits of the memory cache.

The disk cache writes only data when the cache object is located. In a web application, I had to explicitly call the dispose () method in the destroy () method of my servlet. If you do not call dispose () and you do not have a disk usage pattern set in UPDATE, it will not write to disk.

+3
source

Source: https://habr.com/ru/post/1384696/


All Articles