1

I'm looking at Alfresco's logs while fetching documents and I can see that each time I try to retrieve the same doc (same ID), a GET request is made to the remote repository.

I ran a test where I explicitly call session.getDefaultContext().setCacheEnabled(true) before calling session.getObject(id) several times. It seems the cache is ignored as the GET command is issued each time.

Do you think there may be other properties that should be set on the session that I'm missing? Or maybe some xml configuration for Alfresco?

Thanks

4

2 回答 2

2

这取决于您用于检索文档的文档 ID。Alfresco CMIS 文档 ID 如下所示(注意“;vv”部分):

workspace://SpacesStore/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;v.v

Alfresco 也接受看起来像节点 ID 的文档 ID(注意缺少的 ";vv" 部分)来检索文档,但总是返回上述格式。

workspace://SpacesStore/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

OpenCMIS 缓存使用第一个文档 ID 格式(带有“;vv”部分)作为缓存键。如果您使用第二种格式,您将永远不会获得缓存命中,并且客户端必须再次向存储库询问文档数据。

于 2013-10-14T19:35:06.637 回答
0

似乎适用于 getObject,但对于实际检索内容,不使用缓存:

Document document = (Document)session.getObject(id); document.getContentStream().getStream();

最后一行触发 GET 到alfresco_root/folder/content/doc_name?id=id;version

客户端缓存可以实际用于存储文档内容吗?

于 2013-10-15T12:02:34.357 回答