1

I am trying to use Platform cache via Apex Code. 1. Created a new platform cache partition in my org - 10MB assigned to Org Cache. enter image description here

Then created a simple apex class via dev console to access the partition, but just the declaration of the variable gives me a compiler error : Invalid type: Cache.OrgPartition

public class testpartition { 
    private Cache.OrgPartition part; 
}

Has anyone encountered this before? Any advice as to where am i going wrong?

2
  • Did someone define a custom Cache class in your org?
    – Adrian Larson
    Commented Mar 14, 2018 at 15:54
  • spot on ! thanks Adrian ! yes there is a custom Cache class. Commented Mar 15, 2018 at 15:24

2 Answers 2

2

Usually this sort of error crops up when someone introduces a naming collision (i.e. a custom Cache class). You can remove vulnerability to this sort of naming collision by referencing System.Cache.OrgPartition instead:

private System.Cache.OrgPartition part;
1
  • hello Adrian, I tried your suggested option of using System.Cache but still the get the same error at the declaration. screenshot attached. Commented Mar 16, 2018 at 8:16
0

I tried your suggested option of using System.Cache but still the get the same error at the declaration. screenshot attached.enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .