Purger les caches

Purgez les caches de votre scope

Le service CacheService vous permet d’effectuer les opérations getAll, clear et clearAll sur les caches de votre scope.

  • getAll permet de récupérer tous les caches du scope.

  • clearAll purge tous les caches de votre scope.

  • clear permet la purge d’une liste de caches définis par leur nom.

Opération get

Les exemples suivants définissent comment récupérer la liste de tous les caches d’un scope FlowerDocs.


GET /rest/caches HTTP/1.1
Host: {{core}}
token: {{token}}
Content-Type: application/json

@Autowired
private CacheService cacheService;

public String[] getAll() throws FunctionalException, TechnicalException
{
    List<String> cacheNames = cacheService.getAll();
    return cacheNames.toArray(new String[] {});
}

Opérations clear

Les exemples ci-dessous indiquent comment purger les caches d’un scope FlowerDocs en utilisant les différentes opérations de clear.


CLEAR ALL :


DELETE /rest/caches HTTP/1.1
Host: {{core}}
token: {{token}}
Content-Type: application/json

import com.flower.docs.domain.security.Roles;
import com.flower.docs.security.authorities.RoleEvaluator;

@Autowired
private CacheService cacheService;

public void clearAll() throws FunctionalException, TechnicalException
{
    cacheService.clearAll();
}


GET :


DELETE /rest/caches/{names} HTTP/1.1
Host: {{core}}
token: {{token}}
Content-Type: application/json

@Autowired
private CacheService cacheService;

public void clear() throws FunctionalException, TechnicalException
    {
        List<String> cachesToClear = Lists.newArrayList("GEC-user", "GEC-DocumentClass");
        cacheService.clear(cachesToClear);
    }