Cache

 

Configuration. PAGEREF _Toc225226982 \h 2

Attributes. PAGEREF _Toc225226983 \h 3

Input and Output PAGEREF _Toc225226984 \h 5

Input PAGEREF _Toc225226985 \h 5

Output PAGEREF _Toc225226986 \h 6

Functional Demonstration. PAGEREF _Toc225226987 \h 6

Scenario 1. PAGEREF _Toc225226988 \h 6

Add operation. PAGEREF _Toc225226989 \h 7

Update operation. PAGEREF _Toc225226990 \h 8

Lookup operation. PAGEREF _Toc225226991 \h 10

Delete operation. PAGEREF _Toc225226992 \h 11

Useful Tips. PAGEREF _Toc225226993 \h 12

 

Cache component holds data in an in-memory lookup table as a set of name value pairs, identified by one or more designated key name value pairs. A set of key fields and data fields are defined in the CPS of the component. The component stores values for the defined fields as Name Value pairs, where name is the name of the field and value is the data held in the field. A field can be a key field or a data field.

The component support the following operations

The component has the following ports:

Configuration

Figure 1: CPS of Cache component

TOP

Attributes

Field Definition Table

Click  to launch Field Definition Table – an editor to define fields.

Figure 2: Editor to define fields in lookup table

The Field Definition Table contains Name, Type and Key fields.

Name – Name of the field.

Type – Data type of the field. Data type field contains the following field values – int, long, short, float, double, boolean, string and date.

Key – Specifies whether the current field is a Key or a Data field.

To define field definitions –

1.      Click Add button to add a new field definition.

2.      Edit the value in Name column of the newly added row and provide the name of the field.

3.      Select the data type of field value from the drop-down list in Type column.

4.      Select the check box in Key column, if the field is a key field.

5.      Repeat steps 1 to 4 to add all field definitions.

6.      Click Ok.

Note:

Cache threshold

This property determines the maximum number of entries that are held in the lookup table. If the number of entries in the lookup table exceeds the value defined by this property, oldest entries are discarded based on the property Criteria to remove entry.

Note:

Criteria to remove entry

When a threshold is defined, this property determines which entry should be removed after the threshold is reached. Figure 3 shows all the available criteria.

Figure 3: Criteria for removing entries after the threshold is reached

Initial cache size

Initial size with which lookup table has to be initialized. The table will be resized depending on the underlying implementation. Providing an appropriate initial size will reduce the number of resizes.

Validate input

This property determines whether the input message has to be validated against the schema defined on the input ports.

Input messages are validated against the schema defined on the input port on which the message is received.

Input messages are not validated.

Note:

If the input message is not valid and the input validation is disabled, the behavior of the component is undefined.

TOP

Input and Output

The schema for input and output are auto generated based on the field definitions provided in the CPS.

Input

The structure of messages on ADD_PORT for the field definitions shown in Figure 2 is shown in Figure 4.

Figure 4: Structure of messages on ADD_PORT

Note: If the value is not defined for any of the keys, the behavior is not defined.

When a message is received on the ADD_PORT an entry is added, updated or looked up from lookup table based on the elements defined in the input message.

The structure of messages on DEL_PORT for the field definitions shown in Figure 2 is shown in Figure 5.

Figure 5: Structure of messages on DEL_PORT

Note: If the value is not defined for any of the keys, the behavior is not defined.

TOP

Output

Figure 6 contains the structure of messages on OUT_PORT for the field definitions shown in Figure 2.

Figure 6: Structure of messages on OUT_PORT

TOP

Functional Demonstration

Scenario 1

This scenario demonstrates the functioning of the Cache component. Perform the steps shown in this scenario in strict order.

Configure the Cache component as shown in Figure 2 and create a flow as shown in Figure 7. Output port of AddUpdateLookupRequest should be connected to ADD_PORT and output port of DeleteRequest should be connected to DEL_PORT.

Figure 7: Sample flow to demonstrate scenario 1

TOP

Add operation

Send the input shown in Figure 8 from Feeder AddUpdateLookupRequest to add the following entries to lookup table.

1.      ssn:ssn1334 → age:29, name:name

2.      emp_id:88544 → age:29, name:name

Where an entry is in form <key field name>:<key field value> → <data field name>:<data field value>, <data field name>:<data field value>....

Figure 8: Input for add operation

The output message contains all the entries that are added as shown in Figure 9.

Figure 9: Result of add operation

TOP

Update operation

Send the input shown in Figure 10 from Feeder AddUpdateLookupRequest to update the name field for the entry with key field ssn whose value is ssn1334.

Figure 10: Input for update operation

The output message contains the updated entry as shown in Figure 11.

Figure 11: Result of update operation

Entries in the database after the update operation are:

1.      ssn:ssn1334 → age:29, name:name1

2.      emp_id:88544 → age:29, name:name1

Note:

Since both key fields ssn and emp_id are defined under single CacheEntry element in the input of add operation shown in Figure 8, updating a data field value for entry corresponding to ssn key field implicitly updates the entry for emp_id key field as well.

In general, all the key fields defined under single CacheEntry maintain same reference to data fields and updating one effects the other. If this is not the desired behavior modify the input to contain to CacheEntry elements one for each key field as shown in Figure 12

Figure 12: Input in Figure 8 modified to not maintain same reference for key fields

TOP

Lookup operation

Send the input shown in Figure 13 from Feeder AddUpdateLookupRequest to lookup the name and age fields for the entry with key field ssn whose value is ssn1334.

Figure 13: Input for lookup operation

The output message contains the entries looked up from lookup table as shown in Figure 14.

Figure 14: Result of lookup operation

To lookup all the entries in the lookup send, the input shown in Figure 15 from AddUpdateLookupRequest.

Figure 15: Input for lookup of all entries

The output containing all the entries in the lookup table is shown in Figure 16

Figure 16: Output of lookup of all entries

TOP

Delete operation

Send the input shown in Figure 17 from Feeder DeleteRequest to delete the entry with key field ssn whose value is ssn1334.

Figure 17: Input for delete operation

The output message contains the entries that are deleted from lookup table as shown in Figure 18.

Figure 18: Output for delete operation

Send the input shown in Figure 18 from Feeder DeleteRequest to delete all entries in lookup table.

Figure 19: Input for deleting all entries

The output message contains the entries that are deleted from lookup table as shown in Figure 20. Since there is only undeleted entry in the database the output message contains only one entry.

Figure 20: Result of delete all entries operation

TOP

Useful Tips

TOP

Copyright © 1999-2008, Fiorano Software Technologies Pvt. Ltd. All rights reserved.

Copyright © 2008-2009, Fiorano Software Pty. Ltd. All rights reserved.

This software is the confidential and proprietary information of Fiorano Software ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement enclosed with this product or entered into with Fiorano.