- java.lang.Object
-
- com.github.mizosoft.methanol.internal.cache.MemoryStore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.mizosoft.methanol.internal.cache.Store
Store.Editor, Store.EntryReader, Store.EntryWriter, Store.Viewer
-
-
Constructor Summary
Constructors Constructor Description MemoryStore(long maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all entries from this store.voidclose()Closes this store.voiddispose()Atomically clears and closes this store.java.util.Optional<Store.Editor>edit(java.lang.String key)Synchronous variant ofStore.edit(String, Executor).java.util.concurrent.CompletableFuture<java.util.Optional<Store.Editor>>edit(java.lang.String key, java.util.concurrent.Executor executor)Opens an editor for the entry associated with the given key.voidflush()Flushes any indexing data buffered by this store.java.util.Iterator<Store.Viewer>iterator()Returns an iterator ofViewersover the entries in this store.longmaxSize()Returns this store's max size in bytes.booleanremove(java.lang.String key)Removes the entry associated with the given key.longsize()Returns the size in bytes of all entries in this store.java.lang.StringtoString()java.util.Optional<Store.Viewer>view(java.lang.String key)Synchronous variant ofStore.view(String, Executor).java.util.concurrent.CompletableFuture<java.util.Optional<Store.Viewer>>view(java.lang.String key, java.util.concurrent.Executor executor)Opens a viewer for the entry associated with the given key.
-
-
-
Method Detail
-
maxSize
public long maxSize()
Description copied from interface:StoreReturns this store's max size in bytes.
-
size
public long size()
Description copied from interface:StoreReturns the size in bytes of all entries in this store.
-
view
public java.util.Optional<Store.Viewer> view(java.lang.String key)
Description copied from interface:StoreSynchronous variant ofStore.view(String, Executor).
-
view
public java.util.concurrent.CompletableFuture<java.util.Optional<Store.Viewer>> view(java.lang.String key, java.util.concurrent.Executor executor)
Description copied from interface:StoreOpens a viewer for the entry associated with the given key. An empty optional is returned if there's no such entry.
-
edit
public java.util.Optional<Store.Editor> edit(java.lang.String key)
Description copied from interface:StoreSynchronous variant ofStore.edit(String, Executor).
-
edit
public java.util.concurrent.CompletableFuture<java.util.Optional<Store.Editor>> edit(java.lang.String key, java.util.concurrent.Executor executor)
Description copied from interface:StoreOpens an editor for the entry associated with the given key. An empty optional is returned either if there's no such entry, or such entry cannot be edited at the moment.
-
iterator
public java.util.Iterator<Store.Viewer> iterator()
Description copied from interface:StoreReturns an iterator ofViewersover the entries in this store. The iterator doesn't throwConcurrentModificationExceptionwhen the store is asynchronously modified, but there's no guarantee such changes are reflected.
-
remove
public boolean remove(java.lang.String key)
Description copied from interface:StoreRemoves the entry associated with the given key.
-
clear
public void clear()
Description copied from interface:StoreRemoves all entries from this store.
-
dispose
public void dispose()
Description copied from interface:StoreAtomically clears and closes this store.
-
close
public void close()
Description copied from interface:StoreCloses this store. Once the store is closed, all ongoing edits fail, either silently or by throwing an exception, to write or commit anything.
-
flush
public void flush()
Description copied from interface:StoreFlushes any indexing data buffered by this store.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-