All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.client.Cache Maven / Gradle / Ivy

There is a newer version: 5.3.0
Show newest version
package com.alachisoft.ncache.client;
//  Copyright (c) 2019 Alachisoft
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License


import com.alachisoft.ncache.client.services.MessagingService;
import com.alachisoft.ncache.client.services.NotificationService;
import com.alachisoft.ncache.client.services.SearchService;
import com.alachisoft.ncache.runtime.caching.CacheItemAttributes;
import com.alachisoft.ncache.runtime.exceptions.*;
import com.alachisoft.ncache.runtime.util.TimeSpan;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.FutureTask;

/**
 * This interface contians the services and methods that are used to perform operations on the cache.
 */
public interface Cache extends Enumeration, AutoCloseable {

    ///#region fields
    long getCount() throws CacheException;

    /**
     * Displays the information related to this client.
     */
    ClientInfo getClientInfo() throws CacheException;

    /**
     * Gets the information of all connected clients to the cache.
     */
    java.util.List getConnectedClientList() throws CacheException;
    ///#endregion

    //#region services

    /**
     * Gets an instance of
     */
    MessagingService getMessagingService() throws CacheException;

    //endregion

    //#region Add Operations

    CacheItemVersion add(String key, Object value) throws CacheException,IllegalArgumentException;

    CacheItemVersion add(String key, CacheItem item) throws CacheException,IllegalArgumentException;

    java.util.Map addBulk(java.util.Map items) throws CacheException,IllegalArgumentException;

    //endregion

    //#region Insert Operations

    CacheItemVersion insert(String key, Object value) throws CacheException,IllegalArgumentException;

    CacheItemVersion insert(String key, CacheItem item) throws CacheException,IllegalArgumentException ;

    java.util.Map insertBulk(java.util.Map items) throws CacheException,IllegalArgumentException;

    CacheItemVersion insert(String key, CacheItem item, LockHandle lockHandle, boolean releaseLock) throws CacheException,IllegalArgumentException;

    //endregion

    ///#region Get Operations

     T get(String key, Class cls) throws CacheException, IllegalArgumentException, ClassCastException;

     T get(String key, boolean acquireLock, TimeSpan lockTimeout, LockHandle lockHandle, Class cls) throws CacheException, IllegalArgumentException, ClassCastException;

     java.util.Map getBulk(Iterable keys, Class cls) throws CacheException, IllegalArgumentException, ClassCastException;

    CacheItem getCacheItem(String key) throws CacheException,IllegalArgumentException;

    CacheItem getCacheItem(String key, boolean acquireLock, TimeSpan lockTimeout, LockHandle lockHandle) throws CacheException,IllegalArgumentException;

    java.util.Map getCacheItemBulk(Iterable keys) throws CacheException,IllegalArgumentException,ClassCastException;

    ///#endregion

    ///#region Delete Operations

    void delete(String key) throws CacheException,IllegalArgumentException;

    void delete(String key, LockHandle lockHandle) throws CacheException,IllegalArgumentException;

    void deleteBulk(Iterable keys) throws CacheException, IllegalArgumentException,ClassCastException;

    ///#endregion

    ///#region Remove Operations

     T remove(String key, Class cls) throws CacheException, IllegalArgumentException,ClassCastException;

     T remove(String key, LockHandle lockHandle, Class cls) throws CacheException, IllegalArgumentException,ClassCastException ;

     Map removeBulk(Iterable keys, Class cls) throws CacheException, IllegalArgumentException,ClassCastException;

    ///#endregion

    ///#region Conatins Operations

    boolean contains(String key) throws CacheException, IllegalArgumentException;

    Map containsBulk(Iterable keys) throws CacheException;

    ///#endregion

    ///#region Clear Operations

    void clear() throws CacheException;
    ///#endregion

    ///#region Lock Operations

    void unlock(String key) throws CacheException,IllegalArgumentException;

    void unlock(String key, LockHandle lockHandle) throws CacheException,IllegalArgumentException;

    boolean lock(String key, TimeSpan lockTimeout, LockHandle lockHandle) throws CacheException,IllegalArgumentException;


    ///#endregion

    ///#region JsonEnumeration

    Iterator asJsonIterator();

    ///#endregion

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy