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


Java Cacheable类代码示例

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


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

示例1: firstValid

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
@Override
@Cacheable(forever = true)
public byte[] firstValid() throws IOException {
    byte[] result = new byte[0];
    for (final ByteArray array : this.arrays) {
        try {
            result = array.toByteArray();
            break;
        } catch (final IOException ignored) {
            Logger.debug(this, ignored.getMessage());
        }
    }
    if (result.length == 0) {
        throw new IOException("No valid ByteArray found.");
    }
    return result;
}
 
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:18,代码来源:FallbackByteArray.java

示例2: sourceroots

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Get locations of all source roots (with aspects in source form).
 * @return Directories separated
 */
@Cacheable(forever = true)
private String sourceroots() {
    final String path;
    if (this.aspectDirectories == null
        || this.aspectDirectories.length == 0) {
        path = Files.createTempDir().getAbsolutePath();
    } else {
        for (final File dir : this.aspectDirectories) {
            if (!dir.exists()) {
                throw new IllegalStateException(
                    String.format("source directory %s is absent", dir)
                );
            }
        }
        path = StringUtils.join(this.aspectDirectories, AjcMojo.SEP);
    }
    return path;
}
 
开发者ID:jcabi,项目名称:jcabi-maven-plugin,代码行数:23,代码来源:AjcMojo.java

示例3: audioUploadUrl

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Acquires an upload URL for audio files
 * (or used a cached one if it is available).
 * @return Upload URL for audio files.
 * @throws ClientException VK client error.
 * @throws ApiException VK API error.
 */
@Cacheable(forever = true)
private String audioUploadUrl() throws ClientException, ApiException {
    return this.client.audio()
        .getUploadServer(this.actor)
        .execute()
        .getUploadUrl();
}
 
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:15,代码来源:UploadServers.java

示例4: wallPhotoUploadUrl

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Acquires an upload URL for wall photos
 * (or used a cached one if it is available).
 * @return Upload URL for wall photos.
 * @throws ClientException VK client error.
 * @throws ApiException VK API error.
 */
@Cacheable(forever = true)
private String wallPhotoUploadUrl() throws ClientException, ApiException {
    return this.client.photos()
        .getWallUploadServer(this.actor)
        .groupId(UploadServers.GROUP_ID)
        .execute()
        .getUploadUrl();
}
 
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:16,代码来源:UploadServers.java

示例5: audios

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Finds audio files that have not been posted yet.
 * @return An array of audio {@link File}s.
 * @throws IOException If a certain criteria of
 *  {@link com.driver733.vkmusicuploader.audio.Audios}
 *  is not fulfilled.
 */
@Cacheable(forever = true)
private List<File> audios() throws IOException {
    return new AudiosNonProcessed(
        new AudiosBasic(this.dir),
        this.properties
    ).audios();
}
 
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:15,代码来源:WallPostsAlbum.java

示例6: domain

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
@Override
@Cacheable(lifetime = 1, unit = TimeUnit.MINUTES)
public Iterable<Domain> domain(final String name) {
    return new Mapped<>(
        this.origin.domain(name),
        CdDomain::new
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:9,代码来源:CdBase.java

示例7: all

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
@Override
@Cacheable(unit = TimeUnit.HOURS, lifetime = 1)
public Iterable<Domain> all() {
    return new Mapped<>(
        this.origin.all(),
        CdDomain::new
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:9,代码来源:CdBase.java

示例8: bonecp

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Data source.
 * @return Source
 */
@Cacheable(forever = true)
private static DataSource bonecp() {
    final BoneCPDataSource src = new BoneCPDataSource();
    src.setDriverClass("org.postgresql.Driver");
    src.setJdbcUrl(Manifests.read("Aintshy-PgsqlJdbc"));
    src.setUser(Manifests.read("Aintshy-PgsqlUser"));
    src.setPassword(Manifests.read("Aintshy-PgsqlPassword"));
    return src;
}
 
开发者ID:aintshy,项目名称:hub,代码行数:14,代码来源:PgBase.java

示例9: read

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Read byte array.
 * @return Bytes
 * @throws IOException If fails
 */
@Cacheable
private byte[] read() throws IOException {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    this.origin.read(baos);
    return baos.toByteArray();
}
 
开发者ID:jcabi,项目名称:jcabi-s3,代码行数:12,代码来源:CdOcket.java

示例10: location

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
@Cacheable
@Override
public S3Location location() {
    if (this.exists()) {
        Logger.info(
            this,
            "No need to upload %s (%s) to S3, will use existing object",
            this.war,
            FileUtils.byteCountToDisplaySize(this.war.length())
        );
    } else {
        Logger.info(
            this,
            "Uploading %s (%s) to s3://%s/%s... (may take a few minutes)",
            this.war,
            FileUtils.byteCountToDisplaySize(this.war.length()),
            this.bucket, this.key
        );
        final PutObjectResult res = this.client.putObject(
            this.bucket, this.key, this.war
        );
        Logger.info(
            this,
            // @checkstyle LineLength (1 line)
            "Uploaded successfully to S3, etag=%s, expires=%s, exp.rule=%s, encryption=%s, version=%s",
            res.getETag(), res.getExpirationTime(),
            res.getExpirationTimeRuleId(), res.getServerSideEncryption(),
            res.getVersionId()
        );
    }
    return new S3Location(this.bucket, this.key);
}
 
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:33,代码来源:OverridingBundle.java

示例11: aspectpath

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Get locations of all aspect libraries for AJC.
 * @return Classpath
 */
@Cacheable(forever = true)
private String aspectpath() {
    return new StringBuilder(0)
        .append(StringUtils.join(this.classpath(), AjcMojo.SEP))
        .append(AjcMojo.SEP)
        .append(System.getProperty("java.class.path"))
        .toString();
}
 
开发者ID:jcabi,项目名称:jcabi-maven-plugin,代码行数:13,代码来源:AjcMojo.java

示例12: sttc

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Sttc.
 * @return Sttc
 */
@Cacheable(forever = true)
private Sttc sttc() {
    Logger.warn(this, "Sttc connected");
    return new CdSttc(
        new ReSttc(
            RtSttc.make(
                URN.create(Manifests.read("Bib-SttcUrn")),
                Manifests.read("Bib-SttcToken")
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:bibrarian,代码行数:17,代码来源:Lifespan.java

示例13: iterate

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
@Override
@Cacheable(lifetime = 1, unit = TimeUnit.HOURS)
public Iterable<Quote> iterate() {
    return Iterables.transform(
        this.origin.iterate(),
        new Function<Quote, Quote>() {
            @Override
            public Quote apply(final Quote input) {
                return new CdQuote(input);
            }
        }
    );
}
 
开发者ID:yegor256,项目名称:bibrarian,代码行数:14,代码来源:CdQuotes.java

示例14: children

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
/**
 * Get all dependencies of this root artifact.
 * @return The list of artifacts
 * @throws DependencyResolutionException If fails to resolve
 */
@Cacheable(forever = true)
public Collection<Artifact> children()
    throws DependencyResolutionException {
    return this.aether.resolve(
        this.art, JavaScopes.COMPILE, new NonOptionalFilter()
    );
}
 
开发者ID:jcabi,项目名称:jcabi-aether,代码行数:13,代码来源:RootArtifact.java

示例15: add

import com.jcabi.aspects.Cacheable; //导入依赖的package包/类
@Override
@Cacheable.FlushBefore
public void add(final Date date, final long bytes) throws IOException {
    this.origin.add(date, bytes);
}
 
开发者ID:yegor256,项目名称:jare,代码行数:6,代码来源:CdUsage.java


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