Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Response = Memory_Services(Service, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10@Service, @Params)

Returns

The meaning of the response value depends on the service.

Parameters

ParameterDescription
Service@ServiceThe name of the service being requested. Required.
Param1 - Param10@ParamsGeneric parameters. Refer to a specific service to determine the actual parameters used.

Remarks

This SRP FrameWorks utility service is a general purpose error tracking and reporting utility. Unlike OpenInsight error routines, Error_Services does not interfere with normal operations even if a previous error condition was set. The developer is given the right (and responsibility) to make these decisionsdesigned to store small and large amounts of data in memory for quick retrieval. A very common use of Memory_Services is to store the results of other services. Thus, the beginning of each service would first check to see if a value already exists before going through the expense of running the entire service logic again. If the data being stored in Memory_Services needs to be refreshed after a short amount of time, the GetValue service can specify when this should expire.

Services

Clears all error conditions and related informationRemoveKeyRemoveKeyReturns the most current error messageThe most current error message.CreateHashTableCreateHashTable'Returns the stack of error messages. This will be @FM delimited
ServiceDescription
KeyExists

Usage:
Memory_Services('KeyExists', KeyID, CacheName)

Comments:
Sets an error to the stack. This will automatically clear any existing error conditions first so this error will be the only one on the stackReturns a True or False depending on whether the Key ID exists.

Returns:
N/A True if Key ID already exists in the SRP Hash Table, False if it does not exist.

GetValue

Usage:
Memory_Services('GetValue', KeyID, NotExpired, ExpirationDuration, CacheName)

Comments:
Returns the value pair stored in the SRP Hash Table for the current Key ID. If the NotExpired flag is set, the ExpirationDuration will be used to compare against the last time marker set for the current data.

Returns:
The value associated to the Key ID.Adds an error to the stack. This will not clear existing error conditions first. It is intended to allow higher level routines to add more information to an existing error condition or simply to maintain an ongoing error log for some troubleshooting or debugging purposes.Returns:
N/A

SetValue

Usage:
Memory_Services('SetValue', KeyID, Value, CacheName)

Comments:

Updates the value pair stored in the SRP Hash Table for the current Key ID.

Returns:
N/A

IsValueExpired

Usage:
Memory_Services('

IsValueExpired', KeyID, ExpirationDuration, ResetAge, CacheName)

Comments:

This relies upon the time marker set using the SetValue service. If this value has net yet been set then the value will be considered as expired.

Returns:

Returns a Boolean flag indicated whether the current value for the indicated KeyID has expired.

IsValueCurrent

Usage:
Memory_Services('

IsValueCurrent', KeyID, ExpirationDuration, ResetAge, CacheName)

Comments:

This relies upon the time marker set using the SetValue service. If this value has net yet been set then the value will be considered as expired.

Returns:
Returns a Boolean flag indicated whether the current value for the indicated KeyID is still current.

RemoveKeyThe stack of error messages.ReleaseHashTable

Usage:
Memory_Services('ReleaseHashTableRemoveKey', KeyID, CacheName)

Comments:
Returns True if there is an error condition, False if there is no error condition. Caller will still need to use the GetMessage or GetMessages service to determine what the error is. The HasError service allows the caller to embed the Error_Services service call inside of a conditional statement like this:

If Error_Services('HasError') then
* An error has occured. Proceed accordingly.
ErrorMessage = Error_Services('GetMessage')
end else
* No error has occured.
end

Returns:
True if there is an error condition, False if there is no error condition.


Removes the Key ID, and its value pair, from the SRP Hash Table.

Returns:
N/A

CreateHashTable

Usage:
Memory_Services('CreateHashTable', CacheName)

Comments:
Creates the SRP Hash Table that the Memory_Services module will use to manage various Key ID and Value pairs. A check will first be made to see if the handle to the Hash Table already exists. If so then it will be released and a new Hash Table will be created.

Returns:
Returns the handle to the newly created SRP Hash Table.

ReleaseHashTable

Usage:
Memory_Services('ReleaseHashTable', CacheName)

Comments:
Releases the SRP Hash Table handle. If CacheName is empty then the default handle is released.

Returns:
N/A

RemoveAllHashTables

Usage:
Memory_Services('ReleaseHashTable')

Comments:
Releases the all SRP Hash Table handles.

Returns:
N/A

GetHandle

Usage:
Memory_Services('GetHandle', CacheName)

Comments:
Returns True if there are no error conditions, False if there is an error condition. This is the opposite of the HasError service and exists for improved readabilitythe handle to the SRP Hash Table used by Memory_Services.

Returns:
True if there are no error conditions, False if there is an error condition.

...

See comments.

Params

The proper use of the generic arguments are defined in the definition of each service above.

...