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?

  • Did someone define a custom Cache class in your org? – Adrian Larson Mar 14 '18 at 15:54
  • spot on ! thanks Adrian ! yes there is a custom Cache class. – Sheetal Pathak Mar 15 '18 at 15:24
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;
  • hello Adrian, I tried your suggested option of using System.Cache but still the get the same error at the declaration. screenshot attached. – Sheetal Pathak Mar 16 '18 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.