Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: OCXCACHE

OCXCACHE.m

Go to the documentation of this file.
  1. OCXCACHE ;SLC/RJS,CLA - ORDER CHECK CACHE CONTROLLER ;4/16/02 16:28
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**143**;Dec 17,1997
  1. ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
  1. ;
  1. GETDATA(OCXRES,OCXCALL,OCXDFN,OCXTIME) ;
  1. ;
  1. ;
  1. N OCXDATA K OCXRES S OCXRES=""
  1. ;
  1. Q:'$L($G(OCXCALL)) 1
  1. Q:'$L($G(OCXDFN)) 2
  1. S ^XTMP("OCXCACHE",0)=$$FMADD^XLFDT($$NOW^XLFDT,1,"","","")_"^"_$$NOW^XLFDT
  1. S:'$G(OCXTIME) OCXTIME=300
  1. ;
  1. K:($G(^XTMP("OCXCACHE",OCXDFN,OCXCALL,"TIME"))<$$NOW) ^XTMP("OCXCACHE",OCXDFN,OCXCALL)
  1. ;
  1. I '$D(^XTMP("OCXCACHE",OCXDFN,OCXCALL)) D
  1. .I OCXCALL["$$" X "S OCXDATA="_OCXCALL
  1. .E S OCXDATA="" D @OCXCALL
  1. .M ^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")=OCXDATA
  1. .S ^XTMP("OCXCACHE",OCXDFN,OCXCALL,"TIME")=$$NOW+OCXTIME
  1. ;
  1. M:$D(^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")) OCXRES=^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")
  1. Q:'$D(^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")) 3
  1. ;
  1. Q 0
  1. ;
  1. NOW() Q $P($H,",",2)+($H*86400)
  1. ;
  1. PURGE ; Purge OCX namespaced entries in ^XTMP (Cache) that have expired.
  1. ;
  1. N OCXE0,OCXE1,OCXS
  1. ;
  1. ;S OCXS="OCX" F S OCXS=$O(^XTMP(OCXS)) Q:'$L(OCXS) Q:'($E(OCXS,1,3)="OCX") D
  1. S OCXS="OCXCACHE" D
  1. .S OCXE0=0 F S OCXE0=$O(^XTMP(OCXS,OCXE0)) Q:'$L(OCXE0) D
  1. ..S OCXE1="" F S OCXE1=$O(^XTMP(OCXS,OCXE0,OCXE1)) Q:'$L(OCXE1) D
  1. ...K:($G(^XTMP(OCXS,OCXE0,OCXE1,"TIME"))<$$NOW) ^XTMP(OCXS,OCXE0,OCXE1)
  1. ;
  1. Q
  1. ;
  1. ;Sample External Call
  1. ;
  1. ; S ORZ=$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)
  1. ;
  1. ; Changes to:
  1. ;
  1. ;S TEMP=$$GETDATA^OCXCACHE(.ORZ,"$$LOCL^ORQQLR1("_ORDFN_","_TEST_","_SPECIMEN_")",ORDFN,300)
  1. ;
  1. ;$$GETDATA^OCXCACHE(RESULTS,EXTERNAL CALL,PATIENT ID,TIMEOUT) ----> returns either a 1, 2, 3, or 0
  1. ; 0 -> No Errors
  1. ; 1 -> Missing External Call.
  1. ; 2 -> Missing Patient ID.
  1. ; 3 -> Cache Data Missing.
  1. ;***Results = Data Value Returned,
  1. ; Either Scalar or Array.
  1. ;
  1. ;***External Call = Routine call in a 'resolved parameter' format to
  1. ; reduce the chances of cache returning the wrong values.
  1. ;
  1. ; If ORDFN=1234 and TEST=110 and SPECIMEN=119
  1. ;
  1. ; Then If this parameter is: "$$LOCL^ORQQLR1("_ORDFN_","_TEST_","_SPECIMEN_")"
  1. ; then the value will be stored in subscript: "$$LOCL^ORQQLR1(1234,110,119)"
  1. ;
  1. ; If this parameter is: "$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)"
  1. ; then the value will be stored in subscript: "$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)"
  1. ;
  1. ;***Object ID = If this is patient data then this will be the patient's DFN.
  1. ; If this is user data then this will be the user's DUZ.
  1. ; etc...
  1. ;
  1. ;***Timeout = (Optional Default = 300 (5 Minutes)) How long, in seconds, the data has to live in the cache.
  1. ;
  1. ;^XTMP("OCXCACHE",DFN,"$$LOCL^ORQQLR1(1234,110,119)","DATA")= Data
  1. ;
  1. ;^XTMP("OCXCACHE",DFN,"$$LOCL^ORQQLR1(1234,110,119)","TIME")= When the data will be deleted from the cache.
  1. ;
  1. ; $$NOW^OCXCACHE = The number of seconds since the "beginning of time". Used to determine if the data
  1. ; node in the cache is past its expiration date or not.
  1. ;
  1. ; It is very important that ORMTIME is running if this routine is being used.
  1. ; ORMTIME calls OCXOPURG which calls PURGE^OCXCACHE that cleans out expired data
  1. ; in the cache. This will keep the cache from using up all the available diskspace
  1. ; in the Volume Set or directory that ^XTMP resides in. PURGE^OCXCACHE can be run
  1. ; manually from a programmer's prompt if needed.
  1. ;