[ 
https://issues.apache.org/jira/browse/OLINGO-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13874764#comment-13874764
 ] 

Michael Bolz commented on OLINGO-124:
-------------------------------------

Hi Miki,

no problem with the help.
I would then close this issue.

Kind regards,
Michael

> Caching of metadata document
> ----------------------------
>
>                 Key: OLINGO-124
>                 URL: https://issues.apache.org/jira/browse/OLINGO-124
>             Project: Olingo
>          Issue Type: Question
>          Components: odata2-core
>    Affects Versions: V2 1.0.0
>            Reporter: M Carissimi
>            Assignee: Michael Bolz
>            Priority: Minor
>
> We generate the metadata at runtime using custom database queries and in 
> odata4j we can cache the metadata document to avoid having to rebuild it 
> every time a request is received. How can metadata be cached between requests 
> in olingo? Following the simple read example on the olingo website, we use an 
> ODataServiceFactory to create a service using method 
> createODataSingleProcessorService(), but these methods are invoked during 
> each request. 
> Hello Michael,
> the only remaining question I have is about caching of the schemas. I have 
> already attempted to cache the schema list in my custom EdmProvider in the 
> getSchemas() method, but this has had no effect.
> {code}
>   private List<Schema> schemas = new ArrayList<Schema>();
>   ...
>   public List<Schema> getSchemas() throws ODataException
>   {
>     if (schemas.size() == 0)
>     {
>     Schema schema = new Schema();
>     ...
>     schemas.add(schema);
>     }
>     return schemas;
>   }
> {code}
> Running the code in debugging mode, I can see that method createService() of 
> the service factory class configured as initi-parameter of the 
> CXFNonSpringJaxrsServlet servlet is invoked during each invocation and this 
> forces the creation of a new EdmProvider class on each invocation
> {code}
>   private ODataService theODataService = null;
>   ...
>   @Override
>   public ODataService createService(ODataContext ctx) throws ODataException
>   {
>     if (theODataService == null)
>     {
>       EdmProvider edmProvider = new ResourceNoLinksProvider();
>       ODataSingleProcessor singleProcessor = new ResourceSingleProcessor();
>       theODataService = createODataSingleProcessorService(edmProvider, 
> singleProcessor);
>     }
>     return theODataService;
>   }
> {code}
> Do you have any other suggestion about caching the schemas or metadata? In 
> odata4j, we were able to cache the metadata represented by EdmDataServices 
> using a similar approach to the one above. The main difference is that the 
> factory class was invoked by Jesey rather than CXF.
> Regards
> Miki



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to