本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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
);
}
示例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
);
}
示例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;
}
示例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();
}
示例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);
}
示例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();
}
示例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")
)
)
);
}
示例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);
}
}
);
}
示例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()
);
}
示例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);
}