Versions Compared

Key

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

Overview

A sequence defines and caches a list of unique values numbers that PhixFlow allocates from the database and stores in memory. You can then quickly assign the numbers to items .

The curValue and nextValue functions are used to get the current and next values in the cached sequence.

Use the block size to specify the range of values in the sequence. For example, set a block size of 100 to cache 100 consecutive values. PhixFlow checks the database to determine the next available number in the sequence and then sets the next sequence of numbers as "used" in the database. The numbers are stored in the cache. When PhixFlow needs the next number in the sequence, it uses a number from the cache.

When all the values have been used, PhixFlow generates the next set of values in the sequence and saves it to the cache.  

...

using the nextValue function in an expression.You can also find the last assigned number using the curValue function.

For example, you can set up a sequence containing a block of 100 numbers.  PhixFlow reserves the values in memory. Each time an expression runs the nextValue function, it uses a value from memory. When all the numbers have been used, when nextValue() function is called, PhixFlow takes a bit longer to reserve the next block of 100 numbers in the database. 

Tip

It is much quicker for PhixFlow to retrieve assign a value number from the cached sequence memory than it is to go back to the database to calculate reserve the next block of numbers.

Sequence numbers are unique, but there may be gaps between sequence number

...

If something clears the cache, such as Tomcat being restarted, any remaining numbers in the cache are lost. This can lead to item values having gaps in the sequence. 

If you want the items to have a continuous list of sequence values, you can set the block size to 1.. This depends on:

  • the block size specified when the sequence is set up.
  • unexpected server shut-down. Any remaining numbers in memory are lost. 

When PhixFlow reserves the a block, in the database it marks the last reserved value. When the server restarts, PhixFlow reserves a new block from the last reserved value.

This can leave a gap between the last number allocated before PhixFlow was shut down and the first number allocated after PhixFlow is restarted.

For example,

  1. You create a sequence with a block size of 100. It has the values 1-100.
  2. You have allocated the numbers 1 to 50 from memory.
  3. PhixFlow shuts down.
  4. On restart, PhixFlow reserves a new block from 101 to 200.
  5. PhixFlow starts issuing numbers from memory, starting with 101. 
  6. The numbers from 51 to 100 will never be issued.

The Effect of Block Size

Use the block size to specify the range of values in the sequence. The block size affects performance.

A very small block size will increase the number of times that PhixFlow has to go to the database to reserve another block.  This will slow down performance.

A very large block size increases the risk that PhixFlow is shut down while with unallocated numbers in memory.  


If you absolutely need to have contiguous numbers and you don't request these numbers very often you could set the block size to 1.  This will guarantee that numbers are unique and contiguous but may not perform satisfactorily.  In this case you can use alternative means to generate the unique, contiguous numbers you need such as:


<link to recipes for this>.

Sequence Properties

Insert excerpt
_standard_settings
_standard_settings
nopaneltrue

...