Skip to content

ltp88/scala-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

scala-cache

For simple using:

extends SimpleLRUTimeEvictCache and override function loadData

    override protected def loadData(k: K): V = {
        // TODO: Get data code here...
    }

Setting eviction:

    override protected def maxSize: Long = 1000L
    
    override protected def expiredAfterWrite: Option[(Long, TimeUnit)] = Some(5L, TimeUnit.MINUTES)
    
    override protected def expiredAfterAccess: Option[(Long, TimeUnit)] = Some(5L, TimeUnit.MINUTES)

Setting refresh

    override def refreshAfterWrite: Option[(Long, TimeUnit)] = Some(2L, SECONDS)

Removal listening:

    override protected def removal(notification: RemovalNotification[K, V]) = {
        // TODO: handle code here...
    }

Remove:

      protected def remove(k: K)
    
      protected def remove(k: Iterable[K])
    
      protected def removeAll()

Releases

No releases published

Packages

No packages published

Languages