hello/suripu

Cache DeviceAccountPair in workers

Opened this issue · 0 comments

pims commented
    final LoadingCache<String, List<DeviceAccountPair>> pairs = CacheBuilder.newBuilder()
            .maximumSize(1000)
            .expireAfterAccess(10, TimeUnit.MINUTES)
            .build(new CacheLoader<String, List<DeviceAccountPair>>() {
                        public List<DeviceAccountPair> load(String key) throws Exception {
                            return deviceDAO.getAccountIdsForDeviceId(key);
                        }});