ddth-cache-adapter-core/src/main/java/com/github/ddth/cacheadapter/AbstractCache.java
public AbstractCache init() {
        /*
         * Parse custom property: capacity
         */
        long oldCapacity = this.capacity;
        try {
            String entry = getCacheProperty(CACHE_PROP_CAPACITY);
            if (entry != null) {
                this.capacity = Long.parseLong(entry);
            }
        } catch (Exception e) {
            this.capacity = oldCapacity;
            LOGGER.warn(e.getMessage(), e);
        }
        if (capacity < -1) {
            setCapacity(-1);
        }

        /*
         * Parse custom property: expire-after-access
         */
        long oldExpireAfterAccess = this.expireAfterAccess;
        try {
            String entry = getCacheProperty(CACHE_PROP_EXPIRE_AFTER_ACCESS);
            if (entry != null) {
                this.expireAfterAccess = Long.parseLong(entry);
            }
        } catch (Exception e) {
            this.expireAfterAccess = oldExpireAfterAccess;
            LOGGER.warn(e.getMessage(), e);
        }
        if (expireAfterAccess < -1) {
            setExpireAfterAccess(-1);
        }

        /*
         * Parse custom property: expire-after-write
         */
        long oldExpireAfterWrite = this.expireAfterWrite;
        try {
            String entry = getCacheProperty(CACHE_PROP_EXPIRE_AFTER_WRITE);
            if (entry != null) {
                this.expireAfterWrite = Long.parseLong(entry);
            }
        } catch (Exception e) {
            this.expireAfterWrite = oldExpireAfterWrite;
            LOGGER.warn(e.getMessage(), e);
        }
        if (expireAfterWrite < -1) {
            setExpireAfterWrite(-1);
        }

        return this;
    }
public AbstractCache init() {
        /*
         * Parse custom property: capacity
         */
        long oldCapacity = this.capacity;
        try {
            String entry = getCacheProperty(CACHE_PROP_CAPACITY);
            if (entry != null) {
                this.capacity = Long.parseLong(entry);
            }
        } catch (Exception e) {
            this.capacity = oldCapacity;
            LOGGER.warn(e.getMessage(), e);
        }
        if (capacity < -1) {
            setCapacity(-1);
        }

        /*
         * Parse custom property: expire-after-access
         */
        long oldExpireAfterAccess = this.expireAfterAccess;
        try {
            String entry = getCacheProperty(CACHE_PROP_EXPIRE_AFTER_ACCESS);
            if (entry != null) {
                this.expireAfterAccess = Long.parseLong(entry);
            }
        } catch (Exception e) {
            this.expireAfterAccess = oldExpireAfterAccess;
            LOGGER.warn(e.getMessage(), e);
        }
        if (expireAfterAccess < -1) {
            setExpireAfterAccess(-1);
        }

        /*
         * Parse custom property: expire-after-write
         */
        long oldExpireAfterWrite = this.expireAfterWrite;
        try {
            String entry = getCacheProperty(CACHE_PROP_EXPIRE_AFTER_WRITE);
            if (entry != null) {
                this.expireAfterWrite = Long.parseLong(entry);
            }
        } catch (Exception e) {
            this.expireAfterWrite = oldExpireAfterWrite;
            LOGGER.warn(e.getMessage(), e);
        }
        if (expireAfterWrite < -1) {
            setExpireAfterWrite(-1);
        }

        return this;
    }
public AbstractCache init ( ) { /*
         * Parse custom property: capacity
         */ long oldCapacity = this . capacity ; try { String entry = getCacheProperty ( CACHE_PROP_CAPACITY ) ; if ( entry != null ) { this . capacity = Long . parseLong ( entry ) ; } } catch ( Exception e ) { this . capacity = oldCapacity ; LOGGER . warn ( e . getMessage ( ) , e ) ; } if ( capacity < - 1 ) { setCapacity ( - 1 ) ; } /*
         * Parse custom property: expire-after-access
         */ long oldExpireAfterAccess = this . expireAfterAccess ; try { String entry = getCacheProperty ( CACHE_PROP_EXPIRE_AFTER_ACCESS ) ; if ( entry != null ) { this . expireAfterAccess = Long . parseLong ( entry ) ; } } catch ( Exception e ) { this . expireAfterAccess = oldExpireAfterAccess ; LOGGER . warn ( e . getMessage ( ) , e ) ; } if ( expireAfterAccess < - 1 ) { setExpireAfterAccess ( - 1 ) ; } /*
         * Parse custom property: expire-after-write
         */ long oldExpireAfterWrite = this . expireAfterWrite ; try { String entry = getCacheProperty ( CACHE_PROP_EXPIRE_AFTER_WRITE ) ; if ( entry != null ) { this . expireAfterWrite = Long . parseLong ( entry ) ; } } catch ( Exception e ) { this . expireAfterWrite = oldExpireAfterWrite ; LOGGER . warn ( e . getMessage ( ) , e ) ; } if ( expireAfterWrite < - 1 ) { setExpireAfterWrite ( - 1 ) ; } return this ; }
Initializes the cache before use.
Initializes the cache before use .