Giter VIP home page Giter VIP logo

sf-platform-cache-demo's Introduction

Platform Cache Demo

Build Status Codacy Badge

This sample demo shows you how Platform Cache works & increases the performance of your code in some crucial scenarios.

The code contains an Apex Class (PlatformCacheDemoController) which has a method with a SOQL of all Accounts + Child contacts + goes through every contact to see how many contacts has each account.

Definitely this is not the best way to count how many contacts we have, however is a great example of a large operation that can be cached with Platform Cache and retrieve the data from the cache instead of process every time the same method.

Remember that with Platform Cache we can store any structure of data we need. Best practice is not only to replace specific heavy SOQL but to replace heavy loads of data processing as well.

We recommend to create a new Scratch Org, set it as default + create the mock data that exists in this repository (1k Accounts + 2k Contacts);

How to Install

Fully automated process

This process performs the following actions:

  1. Creates a new Scratch Org and sets the new org as default
  2. Push the code to the new Scratch Org
  3. Sets the necessary permission set automatically
  4. Uploads the mock data necessary for testing
npm run sfdx:setup:project

Manual deployment process

New brand Scratch Org

Create a new Scratch Org:

sfdx force:org:create -v YOUR_DEVHUB_ALIAS -a sf-platform-cache-demo -s -f config/project-scratch-def.json

Push the package to the new Scratch Org:

sfdx force:org:push

Your own Sandbox or Developer Edition org

Deploy the code into your target org with Source commands:

sfdx force:source:deploy -p sf-platform-cache-demo

Give you access to the Sample App

Assign to yourself the Permission Set: sf-platform-cache-demo

sfdx force:user:permset:assign -n sf_platform_cache_demo

or

npm run sfdx:permset:assign

Create some sample data in your org

(this commands creates 1k accounts + 2 contacts per account in bulk in your default org)

sfdx force:data:bulk:upsert -s Account -f ./assets/mock_accounts.csv -i External_Id__c
sfdx force:data:bulk:upsert -s Contact -f ./assets/mock_contacts.csv -i Id

or

npm run sfdx:create:data

How the App Works

  • Make sure you have completed all previous steps (new scratch org + permset + mock data upload)
  • Open your Scratch Org & navigate to Platform Cache Demo application & play around with the buttons
sfdx force:org:open -p /lightning/n/Platform_Cache_Demo

or

npm run sfdx:open:demoapp

sf-platform-cache-demo's People

Contributors

raspikabek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.