Package com.google.appengine.api.memcache

Examples of com.google.appengine.api.memcache.Stats


    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        MemcacheService memcacheService = MemcacheServiceFactory.getMemcacheService();
        Stats stats = memcacheService.getStatistics();
        long itemCount = stats.getItemCount();
        logger.info("Clearing memcache, item count in cache: {}", itemCount);
        memcacheService.clearAll();
        resp.getWriter().write("OK, " + itemCount);
    }
View Full Code Here


        memcache.put("work_done", 0);

        Long workDone = memcache.increment("work_done", 1);

        Stats stats = memcache.getStatistics();
        int ageOfOldestItemMillis = stats.getMaxTimeWithoutAccess();

        memcache.setErrorHandler(new StrictErrorHandler());

        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
        fmt.setTimeZone(new SimpleTimeZone(0, ""));
View Full Code Here

        memcache.put("work_done", 0);

        Long workDone = memcache.increment("work_done", 1);

        Stats stats = memcache.getStatistics();
        int ageOfOldestItemMillis = stats.getMaxTimeWithoutAccess();

        memcache.setErrorHandler(new StrictErrorHandler());

        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
        fmt.setTimeZone(new SimpleTimeZone(0, ""));
View Full Code Here

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        MemcacheService memcacheService = MemcacheServiceFactory.getMemcacheService();
        Stats stats = memcacheService.getStatistics();
        long itemCount = stats.getItemCount();
        logger.info("Clearing memcache, item count in cache: {}", itemCount);
        memcacheService.clearAll();
        resp.getWriter().write("OK, " + itemCount);
    }
View Full Code Here

    }

    @Test
    public void testStatistics() {
        Future<Stats> future = asyncMemcache.getStatistics();
        Stats stats = waitOnFuture(future);
        assertNotNull("Stats should never be null.", stats);

        // Only verify that all stats are non-negative.
        assertTrue(stats.getBytesReturnedForHits() > -1L);
        assertTrue(stats.getHitCount() > -1L);
        assertTrue(stats.getItemCount() > -1L);
        assertTrue(stats.getMaxTimeWithoutAccess() > -1);
        assertTrue(stats.getMissCount() > -1L);
        assertTrue(stats.getTotalItemBytes() > -1L);
    }
View Full Code Here

    }

    // A debugging aid to show cache stats along with a failure message
    @SuppressWarnings("unused")
    private String failure(String msg) {
        Stats statistics = memcache.getStatistics();
        StringBuilder sb = new StringBuilder();
        sb
            .append(msg)
            .append(" (")
            .append(statistics.getItemCount())
            .append("/")
            .append(statistics.getHitCount())
            .append("/")
            .append(statistics.getMissCount())
            .append(")");
        return sb.toString();
    }
View Full Code Here

        return Long.MAX_VALUE;
    }

    @Override
    public long getHitCount() {
        final Stats statistics = memcacheService.getStatistics();
        if (null != statistics) {
            return statistics.getHitCount();
        }

        return -1;
    }
View Full Code Here

        return -1;
    }

    @Override
    public long getMissCount() {
        final Stats statistics = memcacheService.getStatistics();
        if (null != statistics) {
            return statistics.getMissCount();
        }

        return -1;
    }
View Full Code Here

        return getCachedCount();
    }

    @Override
    public long getCachedBytes() {
        final Stats statistics = memcacheService.getStatistics();
        if (null != statistics) {
            return statistics.getTotalItemBytes();
        }

        return -1;
    }
View Full Code Here

        return -1;
    }

    @Override
    public long getHitBytes() {
        final Stats statistics = memcacheService.getStatistics();
        if (null != statistics) {
            return statistics.getBytesReturnedForHits();
        }

        return -1;
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.memcache.Stats

Copyright © 2018 www.massapicom. 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.