Code Duplication    Length = 9-13 lines in 5 locations

eZ/Publish/Core/Persistence/Cache/LocationHandler.php 1 location

@@ 232-242 (lines=11) @@
229
    /**
230
     * {@inheritdoc}
231
     */
232
    public function create(CreateStruct $locationStruct)
233
    {
234
        $this->logger->logCall(__METHOD__, array('struct' => $locationStruct));
235
        $location = $this->persistenceHandler->locationHandler()->create($locationStruct);
236
237
        // need to clear loadLocationsByContent and similar collections involving locations data
238
        // also need to clear content info on main location changes
239
        $this->cache->invalidateTags(['content-' . $locationStruct->contentId, 'role-assignment-group-list-' . $locationStruct->contentId]);
240
241
        return $location;
242
    }
243
244
    /**
245
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/UserHandler.php 3 locations

@@ 131-140 (lines=10) @@
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function update(User $user)
132
    {
133
        $this->logger->logCall(__METHOD__, array('struct' => $user));
134
        $return = $this->persistenceHandler->userHandler()->update($user);
135
136
        // Clear corresponding content cache as update of the User changes it's external data
137
        $this->cache->invalidateTags(['content-fields-' . $user->id, 'user-' . $user->id]);
138
139
        return $return;
140
    }
141
142
    /**
143
     * {@inheritdoc}
@@ 145-154 (lines=10) @@
142
    /**
143
     * {@inheritdoc}
144
     */
145
    public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct)
146
    {
147
        $this->logger->logCall(__METHOD__, array('struct' => $userTokenUpdateStruct));
148
        $return = $this->persistenceHandler->userHandler()->updateUserToken($userTokenUpdateStruct);
149
150
        // Clear corresponding content cache as update of the User changes it's external data
151
        $this->cache->invalidateTags(['content-fields-' . $userTokenUpdateStruct->userId, 'user-' . $userTokenUpdateStruct->userId]);
152
153
        return $return;
154
    }
155
156
    /**
157
     * {@inheritdoc}
@@ 426-434 (lines=9) @@
423
    /**
424
     * {@inheritdoc}
425
     */
426
    public function updatePolicy(Policy $policy)
427
    {
428
        $this->logger->logCall(__METHOD__, array('struct' => $policy));
429
        $return = $this->persistenceHandler->userHandler()->updatePolicy($policy);
430
431
        $this->cache->invalidateTags(['policy-' . $policy->id, 'role-' . $policy->roleId]);
432
433
        return $return;
434
    }
435
436
    /**
437
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/NotificationHandler.php 1 location

@@ 44-56 (lines=13) @@
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function updateNotification(APINotification $notification, UpdateStruct $updateStruct): Notification
45
    {
46
        $this->logger->logCall(__METHOD__, [
47
            'notificationId' => $notification->id,
48
        ]);
49
50
        $this->cache->invalidateTags([
51
            'notification-' . $notification->id,
52
            'notification-pending-count-' . $notification->ownerId,
53
        ]);
54
55
        return $this->persistenceHandler->notificationHandler()->updateNotification($notification, $updateStruct);
56
    }
57
58
    /**
59
     * {@inheritdoc}