mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
07.50.2019 219ec32448572da39d629dfcd9c37ec362378ffd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package de.micromata.borgbutler.cache.memory;
 
import lombok.Getter;
 
public abstract class MemoryCacheObject<I> {
    @Getter
    private I identifier;
    long lastAcess;
 
    abstract protected boolean matches(I identifier);
 
    abstract protected int getSize();
 
    boolean _matches(I identifier) {
        if (this.identifier == null || identifier == null) {
            return false;
        }
        if (matches(identifier)) {
            lastAcess = System.currentTimeMillis();
            return true;
        }
        return false;
    }
 
    public MemoryCacheObject(I identifier) {
        this.identifier = identifier;
        lastAcess = System.currentTimeMillis();
    }
 
}