class DBService implements RolesProvider {

    PublicKeyEntry getPublicKeyFromCache(String domainName, String serviceName, String keyId) {
        
        DataCache data = cacheStore.getIfPresent(domainName);
        if (data == null) {
            return null;
        }
            
        AthenzDomain athenzDomain = data.getAthenzDomain();
        if (athenzDomain == null) {
            return null;
        }
        
        List<ServiceIdentity> services = athenzDomain.getServices();
        if (services == null) {
            return null;
        }
        
        final String fullServiceName = ZMSUtils.serviceResourceName(domainName, serviceName);
        for (ServiceIdentity service : services) {
            if (fullServiceName.equals(service.getName())) {
                List<PublicKeyEntry> publicKeys = service.getPublicKeys();
                if (publicKeys != null) {
                    for (PublicKeyEntry publicKey : publicKeys) {
                        if (keyId.equals(publicKey.getId())) {
                            return publicKey;
                        }
                    }
                }
                break;
            }
        }
        
        return null;
    }

    public  DBService(ObjectStore store, AuditLogger auditLogger, ZMSConfig zmsConfig, AuditReferenceValidator auditReferenceValidator);

}