当前位置: 首页>>代码示例>>Java>>正文


Java Cache类代码示例

本文整理汇总了Java中sun.security.util.Cache的典型用法代码示例。如果您正苦于以下问题:Java Cache类的具体用法?Java Cache怎么用?Java Cache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Cache类属于sun.security.util包,在下文中一共展示了Cache类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LDAPCertStoreImpl

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 */
LDAPCertStoreImpl(String serverName, int port)
    throws InvalidAlgorithmParameterException {
    createInitialDirContext(serverName, port);
    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:LDAPCertStoreImpl.java

示例2: SSLSessionContextImpl

import sun.security.util.Cache; //导入依赖的package包/类
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:SSLSessionContextImpl.java

示例3: LDAPCertStore

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:LDAPCertStore.java

示例4: if

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Create a X509CertificatePair from its encoding. Uses cache lookup
 * if possible.
 */
public static synchronized X509CertificatePair generateCertificatePair
        (byte[] encoded) throws CertificateException {
    Object key = new Cache.EqualByteArray(encoded);
    X509CertificatePair pair = cache.get(key);
    if (pair != null) {
        return pair;
    }
    pair = new X509CertificatePair(encoded);
    key = new Cache.EqualByteArray(pair.encoded);
    cache.put(key, pair);
    return pair;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:X509CertificatePair.java

示例5: addToCache

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Add the X509CertImpl or X509CRLImpl to the cache.
 */
private static synchronized <V> void addToCache(Cache<Object, V> cache,
        byte[] encoding, V value) {
    if (encoding.length > ENC_MAX_LENGTH) {
        return;
    }
    Object key = new Cache.EqualByteArray(encoding);
    cache.put(key, value);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:X509Factory.java

示例6: if

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Create a X509CertificatePair from its encoding. Uses cache lookup
 * if possible.
 */
public static synchronized X509CertificatePair generateCertificatePair
        (byte[] encoded) throws CertificateException {
    Object key = new Cache.EqualByteArray(encoded);
    X509CertificatePair pair = (X509CertificatePair)cache.get(key);
    if (pair != null) {
        return pair;
    }
    pair = new X509CertificatePair(encoded);
    key = new Cache.EqualByteArray(pair.encoded);
    cache.put(key, pair);
    return pair;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:17,代码来源:X509CertificatePair.java

示例7: getFromCache

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Get the X509CertImpl or X509CRLImpl from the cache.
 */
private static synchronized Object getFromCache(Cache cache,
        byte[] encoding) {
    Object key = new Cache.EqualByteArray(encoding);
    Object value = cache.get(key);
    return value;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:10,代码来源:X509Factory.java

示例8: addToCache

import sun.security.util.Cache; //导入依赖的package包/类
/**
 * Add the X509CertImpl or X509CRLImpl to the cache.
 */
private static synchronized void addToCache(Cache cache, byte[] encoding,
        Object value) {
    if (encoding.length > ENC_MAX_LENGTH) {
        return;
    }
    Object key = new Cache.EqualByteArray(encoding);
    cache.put(key, value);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:12,代码来源:X509Factory.java


注:本文中的sun.security.util.Cache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。