Search in sources :

Example 1 with CollectionSynchInfo

use of org.bedework.calfacade.CollectionSynchInfo in project bw-calendar-engine by Bedework.

the class CollectionCache method get.

CalendarWrapper get(final String path) throws CalFacadeException {
    CacheInfo ci = cache.get(path);
    if (ci == null) {
        cs.incMisses();
        return null;
    }
    if (ci.checked) {
        cs.incHits();
        return ci.col;
    }
    CollectionSynchInfo csi = cols.getSynchInfo(path, ci.token);
    if (csi == null) {
        // Collection deleted?
        cs.incMisses();
        return null;
    }
    if (!csi.changed) {
        ci.checked = true;
        cs.incHits();
        return ci.col;
    }
    // force refetch
    return null;
}
Also used : CollectionSynchInfo(org.bedework.calfacade.CollectionSynchInfo)

Example 2 with CollectionSynchInfo

use of org.bedework.calfacade.CollectionSynchInfo in project bw-calendar-engine by Bedework.

the class CoreCalendarsDAO method getSynchInfo.

protected CollectionSynchInfo getSynchInfo(final String path, final String token) throws CalFacadeException {
    final HibSession sess = getSess();
    sess.createQuery(getSynchInfoQuery);
    sess.setString("path", path);
    sess.cacheableQuery();
    final Object[] lmfields = (Object[]) sess.getUnique();
    if (lmfields == null) {
        return null;
    }
    final CollectionSynchInfo csi = new CollectionSynchInfo();
    csi.token = BwLastMod.getTagValue((String) lmfields[0], (Integer) lmfields[1]);
    csi.changed = (token == null) || (!csi.token.equals(token));
    return csi;
}
Also used : HibSession(org.bedework.calcorei.HibSession) CollectionSynchInfo(org.bedework.calfacade.CollectionSynchInfo)

Aggregations

CollectionSynchInfo (org.bedework.calfacade.CollectionSynchInfo)2 HibSession (org.bedework.calcorei.HibSession)1