Package org.apache.cassandra.io.util
Class MmappedRegionsCache
java.lang.Object
org.apache.cassandra.io.util.MmappedRegionsCache
- All Implemented Interfaces:
AutoCloseable
It is a utility class for caching
MmappedRegions primarily used by a FileHandle.Builder when a handle
to the same file is created multiple times (as when an sstable is opened early).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getOrCreate(ChannelProxy channel, long length, int bufferSize) Looks for mmapped regions in cache.getOrCreate(ChannelProxy channel, CompressionMetadata metadata, int bufferSize) Looks for mmapped regions in cache.
-
Constructor Details
-
MmappedRegionsCache
public MmappedRegionsCache()
-
-
Method Details
-
getOrCreate
Looks for mmapped regions in cache. If found, a shared copy is created and extended to the provided length. If mmapped regions do not exist yet for the provided key, they are created and a shared copy is returned.- Parameters:
channel- channel for which the mmapped regions are requestedlength- length of the file- Returns:
- a shared copy of the cached mmapped regions
-
getOrCreate
public MmappedRegions getOrCreate(ChannelProxy channel, CompressionMetadata metadata, int bufferSize) Looks for mmapped regions in cache. If found, a shared copy is created and extended according to the provided metadata. If mmapped regions do not exist yet for the provided key, they are created and a shared copy is returned.- Parameters:
channel- channel for which the mmapped regions are requestedmetadata- compression metadata of the file- Returns:
- a shared copy of the cached mmapped regions
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-