Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

How should I configure cacheAllData on a RestDatasource properly?

$
0
0
Hi there,

I've defined a RestDataSource with cachAllData=true and an OperationBinding like

Code:

.. other bindings here, amonst others, the default fetch operation binding
...
final OperationBinding cacheSyncFetch = new OperationBinding();
cacheSyncFetch.setOperationType(DSOperationType.FETCH);
cacheSyncFetch.setOperationId("cacheSync");                cacheSyncFetch.setDataURL(ResourceUtil.getSmartcoreDSBaseURL());
final DSRequest csReq = new DSRequest();
Criteria cacheSyncCriteria = getCacheSyncCriteria();
csReq.setCriteria(cacheSyncCriteria);
csReq.setHttpMethod("POST");
cacheSyncFetch.setRequestProperties(csReq);
ds.addBinding(cacheSyncFetch);

I want the datasource to use the above operationBinding for the initial cache data request. However, I don't see any possibility to configure the datasource because the Datasource-API does not seem to define an appropriate Java-Setter.
Setting the attribute directly in the datasource contructor via setAttribute("cacheAllOperationId", "cacheSync") does not seem to have any effect. So how can I tell the datasource to use my CacheSync-OperationBinding?

Next question: What is the recommended way to drop/refresh the client-side datasource cache?
Is it right to use datasource.setCacheData(new Record[0]); in order to drop the client side datasource cache for a Datasource with cacheAllData=true? Will the datasource refresh its cache automatically?


I do NOT use the Smartclient Server Backend.

I'm Using SmartClient Version: v9.1p_2014-03-05/LGPL Development Only (built 2014-03-05) on the client-side.

Any advice is appreciated. Thanks in advance.

Viewing all articles
Browse latest Browse all 4756

Trending Articles