Home > Cache > Calling Cache Store Procedure through SQL

Calling Cache Store Procedure through SQL

We can call a cache SP from SQL in the following way.

Define SP in Cache:-

Class User.test Extends %Persistent
{
 
   ClassMethod t1(p as %String) As %String [ SqlProc ]
  {
     s ^Asad($H)=p
     q 1
  }
}

Query to Call this SP:-
select Test_t1(’Test1′) from SQLUser.Test

Example to calling SP if the class is in package:-

Class TestPkg.test Extends %Persistent
{

ClassMethod t1(p As %String) As %String [ SqlProc ]
{
      s ^Asad($zdt($H))=p
      q 1
}
}

SQL Query :-

 

select TestPkg.Test_t1(’Test1′) from TestPkg.Test 

 

This is the way how you can call cache store procedures from SQL. This is very helpful in the scenarios when using cache with other languages like java or .net.

Cache , , , ,

  1. No comments yet.
  1. No trackbacks yet.