private Object[] getFromCache( Object[] keyValues, Date dateValue ) throws KettleValueException { if ( data.cacheValueRowMeta == null ) { // nothing in the cache yet, no lookup was ever performed if ( data.returnRowMeta == null ) { return null; } data.cacheValueRowMeta = assembleCacheValueRowMeta(); } byte[] key = RowMeta.extractData( data.cacheKeyRowMeta, keyValues ); byte[] value = data.cache.get( key ); if ( value != null ) { Object[] row = RowMeta.getRow( data.cacheValueRowMeta, value ); // See if the dateValue is between the from and to date ranges... // The last 2 values are from and to long time = dateValue.getTime(); long from = ( (Date) row[ row.length - 2 ] ).getTime(); long to = ( (Date) row[ row.length - 1 ] ).getTime(); if ( time >= from && time < to ) { // sanity check to see if we have the right version if ( isRowLevel() ) { logRowlevel( "Cache hit: key=" + data.cacheKeyRowMeta.getString( keyValues ) + " values=" + data.cacheValueRowMeta.getString( row ) ); } return row; } } return null; }
byte[] keyPart = RowMeta.extractData( data.cacheKeyRowMeta, keyValues ); byte[] valuePart = RowMeta.extractData( data.cacheValueRowMeta, returnValues ); data.cache.put( keyPart, valuePart );
} else { try { byte[] value = data.hashIndex.get( RowMeta.extractData( keyMeta, keyData ) ); if ( value == null ) { return null;
.put( RowMeta.extractData( keyMeta, keyData ), RowMeta.extractData( valueMeta, valueData ) );