Skip to content

Add a beforeInvocation option on @CacheEvict annotation #5

@benjamindulau

Description

@benjamindulau
<?php

/**
 * @Cacheable(caches="followers", key="#user.getUsername()")
 */
public function getAllFollowersForUser(User $user)
{
    return $followers;
}

/**
 * @CacheEvict(caches="followers", key="#user.getUsername()", beforeInvocation=true)
 */
public function regenerateFollowersList(User $user)
{
    $followers = $this->getAllFollowersForUser($user);
    $this->flattenFollowerList($user, $followers);   
}

/**
 * @Cacheable(caches="followers", key="[#user.getUsername(), 'flat']")
 */
public function flattenFollowerList(User $user, $followers)
{
    // ...

    return $flatFollowerList;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions