Skip to content

Commit c4f0232

Browse files
committed
Fix links
1 parent 301b0de commit c4f0232

File tree

2 files changed

+43
-31
lines changed

2 files changed

+43
-31
lines changed

website/docs/cache/basic-features.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_position: 15
88

99
SOQLCache provides three different cache storage levels, each with different scope and persistence:
1010

11-
```apex
11+
```apex title="Apex Transaction Cache"
1212
// Cache in Apex Transaction - fastest, limited to current transaction
1313
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
1414
.with(Profile.Id, Profile.Name)
@@ -17,7 +17,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
1717
.toObject();
1818
```
1919

20-
```apex
20+
```apex title="Org Cache"
2121
// Cache in Org Cache - persists across transactions and users
2222
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
2323
.with(Profile.Id, Profile.Name)
@@ -26,7 +26,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
2626
.toObject();
2727
```
2828

29-
```apex
29+
```apex title="Session Cache"
3030
// Cache in Session Cache - persists for user session
3131
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
3232
.with(Profile.Id, Profile.Name)
@@ -41,7 +41,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
4141

4242
All cached records have an additional field called `cachedDate`. To avoid using outdated records, you can configure `maxHoursWithoutRefresh` to automatically refresh stale cache entries:
4343

44-
```apex
44+
```apex title="Auto-refresh Configuration"
4545
// Auto-refresh cache after 12 hours
4646
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
4747
.with(Profile.Id, Profile.Name, Profile.UserType)
@@ -50,7 +50,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
5050
.toObject();
5151
```
5252

53-
```apex
53+
```apex title="SOQL_CachedProfile.cls"
5454
// Custom refresh interval in cached selector
5555
public inherited sharing class SOQL_CachedProfile extends SOQLCache implements SOQLCache.Selector {
5656
private SOQL_CachedProfile() {
@@ -66,7 +66,7 @@ public inherited sharing class SOQL_CachedProfile extends SOQLCache implements S
6666

6767
Cached selectors extend SOQLCache and provide default cache configurations, fields, and reusable methods. Each cached selector focuses on a single SObjectType with optimal caching strategy.
6868

69-
```apex
69+
```apex title="SOQL_CachedProfile.cls"
7070
public inherited sharing class SOQL_CachedProfile extends SOQLCache implements SOQLCache.Selector {
7171
public static SOQL_CachedProfile query() {
7272
return new SOQL_CachedProfile();
@@ -99,7 +99,7 @@ public inherited sharing class SOQL_CachedProfile extends SOQLCache implements S
9999

100100
**Usage Example:**
101101

102-
```apex
102+
```apex title="Cached Selector Usage"
103103
// Get single profile from cache
104104
Profile adminProfile = (Profile) SOQL_CachedProfile.query()
105105
.byName('System Administrator')
@@ -128,7 +128,7 @@ The initial query allows for bulk population of records in the cache when it's e
128128
**Design Philosophy:**
129129
When the cache is empty, execute a single query to populate all commonly used records. This dramatically reduces the number of database queries for frequently accessed data like Profiles, BusinessHours, or OrgWideEmailAddress.
130130

131-
```apex
131+
```apex title="SOQL_CachedProfile.cls"
132132
public inherited sharing class SOQL_CachedProfile extends SOQLCache implements SOQLCache.Selector {
133133
private SOQL_CachedProfile() {
134134
super(Profile.SObjectType);
@@ -147,7 +147,7 @@ public inherited sharing class SOQL_CachedProfile extends SOQLCache implements S
147147
**How It Works:**
148148
When `SOQL_CachedProfile.query().byName('System Administrator').toObject()` is called and the cache is empty, the initial query executes to populate ALL profiles in cache. Subsequent queries retrieve from cache without hitting the database.
149149

150-
```apex
150+
```apex title="ExampleController.cls"
151151
public with sharing class ExampleController {
152152
@AuraEnabled
153153
public static Id getSystemAdminProfileId() {
@@ -175,7 +175,7 @@ Unlike standard SOQL queries that use `WITH USER_MODE`, cached records require t
175175

176176
The `Security.stripInaccessible` method is the only FLS method that works with cached records, as it can remove inaccessible fields from already retrieved data.
177177

178-
```apex
178+
```apex title="Default FLS"
179179
// Apply FLS to cached records
180180
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
181181
.with(Profile.Id, Profile.Name, Profile.UserType)
@@ -184,7 +184,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
184184
.toObject();
185185
```
186186

187-
```apex
187+
```apex title="Custom AccessType"
188188
// Apply specific AccessType
189189
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
190190
.with(Profile.Id, Profile.Name, Profile.UserType)
@@ -201,15 +201,15 @@ Cached queries have specific filtering requirements to ensure data consistency a
201201

202202
By default, cached queries can only filter by unique fields (`Id`, `Name`, `DeveloperName`, or schema-defined unique fields). This prevents inconsistencies between cached and database records.
203203

204-
```apex
204+
```apex title="Allowed - Unique Field"
205205
// ✅ Allowed - filtering by unique field
206206
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
207207
.with(Profile.Id, Profile.Name)
208208
.whereEqual(Profile.Name, 'System Administrator')
209209
.toObject();
210210
```
211211

212-
```apex
212+
```apex title="Not Allowed - Non-unique Field"
213213
// ❌ Not allowed - UserType is not unique
214214
// Throws: SoqlCacheException
215215
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
@@ -222,7 +222,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
222222

223223
For specific use cases, you can override the unique field requirement:
224224

225-
```apex
225+
```apex title="Override Non-unique Filter"
226226
// Allow filtering by non-unique fields
227227
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
228228
.with(Profile.Id, Profile.Name, Profile.UserType)
@@ -235,7 +235,7 @@ Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
235235

236236
Cached queries require at least one WHERE condition to ensure specific record retrieval:
237237

238-
```apex
238+
```apex title="Query Without Conditions"
239239
// Allow queries without conditions (for small datasets)
240240
Profile profile = (Profile) SOQLCache.of(Profile.SObjectType)
241241
.with(Profile.Id, Profile.Name)
@@ -249,7 +249,7 @@ SOQLCache supports mocking for unit tests. You can mock either the cached result
249249

250250
### Mock Cached Results
251251

252-
```apex
252+
```apex title="ExampleController.cls"
253253
public with sharing class ExampleController {
254254
public static Profile getSystemAdminProfile() {
255255
return (Profile) SOQL_CachedProfile.query()
@@ -262,7 +262,7 @@ public with sharing class ExampleController {
262262

263263
**Test Implementation:**
264264

265-
```apex
265+
```apex title="ExampleControllerTest.cls"
266266
@IsTest
267267
private class ExampleControllerTest {
268268
@IsTest
@@ -289,7 +289,7 @@ private class ExampleControllerTest {
289289

290290
You can also mock the underlying SOQL query that populates the cache:
291291

292-
```apex
292+
```apex title="SOQL_CachedProfileTest.cls"
293293
@IsTest
294294
private class SOQL_CachedProfileTest {
295295
@IsTest
@@ -319,7 +319,7 @@ Manual cache removal allows you to clear specific records from cache, triggering
319319

320320
### Trigger-Based Cache Invalidation
321321

322-
```apex
322+
```apex title="ProfileTrigger.trigger"
323323
trigger ProfileTrigger on Profile (after update, after delete) {
324324
// Clear cached profiles when they're updated or deleted
325325
SOQLCache.removeFromCache(Trigger.old);
@@ -328,7 +328,7 @@ trigger ProfileTrigger on Profile (after update, after delete) {
328328

329329
### Programmatic Cache Removal
330330

331-
```apex
331+
```apex title="ProfileController.cls"
332332
public with sharing class ProfileController {
333333
@AuraEnabled
334334
public static void updateProfileSettings(Id profileId, String newName) {
@@ -377,7 +377,7 @@ Cache is most effective for:
377377

378378
### Memory Usage
379379

380-
```apex
380+
```apex title="Efficient Memory Usage"
381381
// Efficient - minimal fields cached
382382
SOQL_CachedProfile.query()
383383
.with(Profile.Id, Profile.Name) // Only cache needed fields
@@ -391,7 +391,7 @@ SOQLCache provides streamlined result methods optimized for cached data retrieva
391391

392392
### Available Result Methods
393393

394-
```apex
394+
```apex title="Available Result Methods"
395395
Id toId() // Get record ID
396396
Id toIdOf(SObjectField field) // Get ID from specific field
397397
Boolean doExist() // Check if record exists
@@ -403,7 +403,7 @@ SObject toObject() // Get single record
403403

404404
**Traditional approach:**
405405

406-
```apex
406+
```apex title="Traditional SOQL"
407407
public static Id getSystemAdminProfileId() {
408408
Profile profile = [
409409
SELECT Id
@@ -417,7 +417,7 @@ public static Id getSystemAdminProfileId() {
417417

418418
**With SOQLCache:**
419419

420-
```apex
420+
```apex title="With SOQLCache"
421421
public static Id getSystemAdminProfileId() {
422422
return SOQL_CachedProfile.query()
423423
.byName('System Administrator')
@@ -429,7 +429,7 @@ public static Id getSystemAdminProfileId() {
429429

430430
**Traditional approach:**
431431

432-
```apex
432+
```apex title="Traditional SOQL"
433433
public static String getSystemAdminUserType() {
434434
Profile profile = [
435435
SELECT UserType
@@ -443,7 +443,7 @@ public static String getSystemAdminUserType() {
443443

444444
**With SOQLCache:**
445445

446-
```apex
446+
```apex title="With SOQLCache"
447447
public static String getSystemAdminUserType() {
448448
return (String) SOQL_CachedProfile.query()
449449
.byName('System Administrator')
@@ -455,7 +455,7 @@ public static String getSystemAdminUserType() {
455455

456456
**Traditional approach:**
457457

458-
```apex
458+
```apex title="Traditional SOQL"
459459
public static Boolean hasStandardUserProfile() {
460460
List<Profile> profiles = [
461461
SELECT Id
@@ -469,7 +469,7 @@ public static Boolean hasStandardUserProfile() {
469469

470470
**With SOQLCache:**
471471

472-
```apex
472+
```apex title="With SOQLCache"
473473
public static Boolean hasStandardUserProfile() {
474474
return SOQL_CachedProfile.query()
475475
.byName('Standard User')
@@ -479,7 +479,7 @@ public static Boolean hasStandardUserProfile() {
479479

480480
### Get Related Field ID from Cache
481481

482-
```apex
482+
```apex title="Related Field ID"
483483
// Get UserLicenseId from cached Profile
484484
public static Id getProfileUserLicenseId(String profileName) {
485485
return SOQL_CachedProfile.query()

website/docusaurus.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,25 @@ const config = {
160160
{
161161
title: 'Documentation',
162162
items: [
163+
{
164+
label: 'Get Started',
165+
to: '/docs/getting-started'
166+
},
163167
{
164168
label: 'Installation',
165169
to: '/installation'
166170
},
167171
{
168-
label: 'Building Your Selector',
169-
to: '/building-your-selector'
172+
label: 'SOQL Module',
173+
to: '/soql/getting-started'
174+
},
175+
{
176+
label: 'Cache Module',
177+
to: '/cache/getting-started'
178+
},
179+
{
180+
label: 'Evaluator Module',
181+
to: '/evaluator/getting-started'
170182
}
171183
]
172184
},

0 commit comments

Comments
 (0)