Skip to content

Commit 8cd1415

Browse files
committed
removeFromCache
Signed-off-by: Piotr PG Gajek <[email protected]>
1 parent bfc3f6c commit 8cd1415

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

force-app/main/default/classes/main/cached-soql/SOQLCache.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public virtual inherited sharing class SOQLCache implements Cacheable {
6161
mock.setMock(mockId, new List<SObject>{ record });
6262
}
6363

64-
public static void refreshRecords(List<SObject> records) {
64+
public static void removeFromCache(List<SObject> records) {
6565
if (records.isEmpty()) {
6666
return;
6767
}

force-app/main/default/classes/main/cached-soql/SOQLCache_Test.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ private class SOQLCache_Test {
573573
Assert.isFalse(((List<SOQLCache.CacheItem>) CacheManager.SOQLOrgCache.get('Profile')).isEmpty(), 'Cache item should be present.');
574574

575575
// Test
576-
SOQLCache.refreshRecords(new List<Profile>{ profile });
576+
SOQLCache.removeFromCache(new List<Profile>{ profile });
577577

578578
// Verify
579579
Assert.isTrue(CacheManager.SOQLOrgCache.contains('Profile'), 'Key should still exist.');
@@ -594,7 +594,7 @@ private class SOQLCache_Test {
594594
Assert.isFalse(((List<SOQLCache.CacheItem>) CacheManager.SOQLOrgCache.get('Profile')).isEmpty(), 'Cache item should be present.');
595595

596596
// Test
597-
SOQLCache.refreshRecords(new List<Profile>());
597+
SOQLCache.removeFromCache(new List<Profile>());
598598

599599
// Verify
600600
Assert.isTrue(CacheManager.SOQLOrgCache.contains('Profile'), 'Key should still exist.');

website/docs/api/cached-soql/soql-cache.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The following are methods for using `SOQLCache`:
2929
[**CACHE EXPIRATION**](#cache-expiration)
3030

3131
- [`maxHoursWithoutRefresh()`](#maxhourswithoutrefresh)
32-
- [`refreshRecords(List<SObject> records)`](#refreshrecords)
32+
- [`removeFromCache(List<SObject> records)`](#removeFromCache)
3333

3434
[**INITIAL QUERY**](#initial-query)
3535

@@ -183,21 +183,21 @@ SOQLCache.of(Profile.SObjectType)
183183
.toObject();
184184
```
185185

186-
### refreshRecords
186+
### removeFromCache
187187

188-
The `refreshRecords` method allows clearing records from the cache, triggering an automatic refresh the next time the query is executed.
188+
The `removeFromCache` method allows clearing records from the cache, triggering an automatic refresh the next time the query is executed.
189189

190190
**Signature**
191191

192192
```apex
193-
Cacheable refreshRecords(List<SObject> records)
193+
Cacheable removeFromCache(List<SObject> records)
194194
```
195195

196196
**Example**
197197

198198
```apex
199199
trigger SomeObjectTrigger on SomeObject (after update, after delete) {
200-
SOQLCache.refreshRecords(Trigger.new);
200+
SOQLCache.removeFromCache(Trigger.new);
201201
}
202202
```
203203

0 commit comments

Comments
 (0)