Examples of TilePage


Examples of org.geowebcache.diskquota.storage.TilePage

   
    public void testGetLeastFrequentlyUsedPageSkipEmpty() throws Exception {
        final String layerName = testTileSet.getLayerName();
        Set<String> layerNames = Collections.singleton(layerName);

        TilePage lfuPage;
        lfuPage = store.getLeastFrequentlyUsedPage(layerNames);
        assertNull(lfuPage);

        TilePage page1 = new TilePage(testTileSet.getId(), 0, 1, 2);
        TilePage page2 = new TilePage(testTileSet.getId(), 1, 1, 2);

        PageStatsPayload payload1 = new PageStatsPayload(page1, testTileSet);
        PageStatsPayload payload2 = new PageStatsPayload(page2, testTileSet);

        payload1.setNumHits(100);
        payload2.setNumHits(10);
        Collection<PageStatsPayload> statsUpdates = Arrays.asList(payload1, payload2);
        store.addHitsAndSetAccesTime(statsUpdates).get();

        TilePage leastFrequentlyUsedPage = store.getLeastFrequentlyUsedPage(layerNames);
        assertEquals(page2, leastFrequentlyUsedPage);

        store.setTruncated(page2);

        leastFrequentlyUsedPage = store.getLeastFrequentlyUsedPage(layerNames);
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

        SystemUtils.set(mockSystemUtils);

        final String layerName = testTileSet.getLayerName();
        Set<String> layerNames = Collections.singleton(layerName);

        TilePage leastRecentlyUsedPage;
        leastRecentlyUsedPage = store.getLeastRecentlyUsedPage(layerNames);
        assertNull(leastRecentlyUsedPage);

        TilePage page1 = new TilePage(testTileSet.getId(), 0, 1, 2);
        TilePage page2 = new TilePage(testTileSet.getId(), 1, 1, 2);

        PageStatsPayload payload1 = new PageStatsPayload(page1, testTileSet);
        PageStatsPayload payload2 = new PageStatsPayload(page2, testTileSet);

        payload1.setLastAccessTime(mockSystemUtils.currentTimeMillis() + 1 * 60 * 1000);
 
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

        SystemUtils.set(mockSystemUtils);

        final String layerName = testTileSet.getLayerName();
        Set<String> layerNames = Collections.singleton(layerName);

        TilePage leastRecentlyUsedPage;
        leastRecentlyUsedPage = store.getLeastRecentlyUsedPage(layerNames);
        assertNull(leastRecentlyUsedPage);

        TilePage page1 = new TilePage(testTileSet.getId(), 0, 1, 2);
        TilePage page2 = new TilePage(testTileSet.getId(), 1, 1, 2);

        PageStatsPayload payload1 = new PageStatsPayload(page1, testTileSet);
        PageStatsPayload payload2 = new PageStatsPayload(page2, testTileSet);

        payload1.setLastAccessTime(mockSystemUtils.currentTimeMillis() + 1 * 60 * 1000);
 
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

        leastRecentlyUsedPage = store.getLeastRecentlyUsedPage(layerNames);
        assertEquals(page2, leastRecentlyUsedPage);
    }

    public void testGetTilesForPage() throws Exception {
        TilePage page = new TilePage(testTileSet.getId(), 0, 0, 0);

        long[][] expected = tilePageCalculator.toGridCoverage(testTileSet, page);
        long[][] tilesForPage = store.getTilesForPage(page);

        assertTrue(Arrays.equals(expected[0], tilesForPage[0]));

        page = new TilePage(testTileSet.getId(), 0, 0, 1);

        expected = tilePageCalculator.toGridCoverage(testTileSet, page);
        tilesForPage = store.getTilesForPage(page);

        assertTrue(Arrays.equals(expected[1], tilesForPage[1]));
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

                log.warn("Aborting disk quota enforcement task, no expiration policy defined for layers "
                        + layerNames);
                return;
            }

            TilePage tilePage = null;
            if (ExpirationPolicy.LFU.equals(expirationPolicy)) {
                tilePage = pageStore.getLeastFrequentlyUsedPage(layerNames);
            } else if (ExpirationPolicy.LRU.equals(expirationPolicy)) {
                tilePage = pageStore.getLeastRecentlyUsedPage(layerNames);
            } else {
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

        PageStatsPayload timedUpdate = aggregatedPendingUpdates.pages.get(pageKeyForTile);
        if (timedUpdate == null) {
            /*
             * it is the first one for this tile set, lets start the aggregated updates on it
             */
            timedUpdate = new PageStatsPayload(new TilePage(tileSetId, pageX, pageY, pageZ));
            timedUpdate.setTileSet(tileSet);

            aggregatedPendingUpdates.pages.put(pageKeyForTile, timedUpdate);
        } else {
            timedUpdate.setNumHits(timedUpdate.getNumHits() + 1);
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

     */
    public TilePage getLeastFrequentlyUsedPage(final Set<String> layerNames)
            throws InterruptedException {

        SecondaryIndex<Float, Long, PageStats> expirationPolicyIndex = pageStatsByLFU;
        TilePage nextToExpire = issueSync(new FindPageToExpireByLayer(expirationPolicyIndex,
                layerNames));

        return nextToExpire;
    }
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

     * @see org.geowebcache.diskquota.QuotaStore#getLeastRecentlyUsedPage(java.util.Set)
     */
    public TilePage getLeastRecentlyUsedPage(final Set<String> layerNames)
            throws InterruptedException {
        SecondaryIndex<Float, Long, PageStats> expirationPolicyIndex = pageStatsByLRU;
        TilePage nextToExpire = issueSync(new FindPageToExpireByLayer(expirationPolicyIndex,
                layerNames));

        return nextToExpire;
    }
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

        sysUtils.setCurrentTimeMillis(10 * 60 * 1000);
        SystemUtils.set(sysUtils);

        TileSet tileSet = testTileSet;

        TilePage page = new TilePage(tileSet.getId(), 0, 0, (byte) 0);

        PageStatsPayload payload = new PageStatsPayload(page);
        int numHits = 100;
        payload.setLastAccessTime(sysUtils.currentTimeMillis() - 1 * 60 * 1000);
        payload.setNumHits(numHits);
View Full Code Here

Examples of org.geowebcache.diskquota.storage.TilePage

        // make sure the layer is there and has stuff
        Quota usedQuota = store.getUsedQuotaByLayerName(layerName);
        assertNotNull(usedQuota);

        TileSet tileSet = tilePageCalculator.getTileSetsFor(layerName).iterator().next();
        TilePage page = new TilePage(tileSet.getId(), 0, 0, (byte) 0);
        store.addHitsAndSetAccesTime(Collections.singleton(new PageStatsPayload(page)));
        // page.setNumHits(10);
        // page.setLastAccessTime(System.currentTimeMillis());
        // store.addHitsAndSetAccesTime(page);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.