MFP 8.0适配器缓存 [英] MFP 8.0 adapter cache

查看:118
本文介绍了MFP 8.0适配器缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MFP 8.0,并且我们需要在适配器级别实现缓存。

I am using MFP 8.0, and there are requirements that we want implement cache on the adapter level.

每当MFP服务器启动时,我们都希望将所有数据库转储到缓存,直到服务器重新启动。

Whenever MFP server starts we want to dump all the database in cache till the server restart again.

现在,每当用户点击调用数据库的某个事务或适配器过程而不是调用数据库时,它必须从缓存中读取。

Now whenever user hit some transaction or adapter procedure which call database so instead of calling database it must read from cache.

推荐答案

根据您的描述,假设您正在讨论存储数据的某些自定义数据库,那么您需要实现缓存数据的逻辑。

From your description, assuming you are talking about some custom DB where you have data stored, then you need to implement the logic of caching the data.

适配器有两个类< AdapterName> Application.java < AdapterName> Resource.java 。 <> Application.java包含生命周期方法 - init() destroy()

Adapter's have two classes <AdapterName>Application.java and <AdapterName>Resource.java. <>Application.java contains the lifecycle methods - init() and destroy().

您应该在数据库中将自定义的加载数据代码放入 init()方法的缓存中。并且还要注意在 destroy()中删除​​它。

You should put your custom code of loading data from your DB into cache in the init() method. And also take care of removing it in the destroy().

现在在事务访问期间(点击< > Resource.java),您指的是您已创建的缓存。

Now during transactional access (which hits <>Resource.java), you refer to the cache you have already created.

您的要求可能不适合负载较重的系统。你需要考虑:

Your requirement, however may not be ideal for heavily loaded systems. You need to consider that:

a)你的适配器初始化被延迟了。任何错误编写的代码也可能破坏适配器初始化。在初始化请求之前,适配器无法为您的请求提供服务。如果是群集环境,则所有群集成员中的适配器负载将根据您加载的数据量而延迟。用于此适配器的任何客户端请求都将获得运行时异常,直到初始化完成。

a) Your adapter initialization is delayed. Any wrongly written code can also break the adapter initialization. An adapter isn't available to service your request until it has been initialized. In case of a clustered environment, the adapter load in all cluster members will delayed depending on the amount of data your are loading. Any client request intended for this adapter will get a runtime exception until the initialization is complete.

b)将缓存保存在内存中意味着堆中的这么多空间用完了。如果您的数据库不断增长,这会对适配器初始化以及堆使用产生不利影响。

b) Holding the cache in memory means, so much space in the heap is used up. If your DB keeps growing, this adversely affects adapter initialization and also heap usage.

c)您负责维护最新级别的数据,并在使用后进行清理。

c) You are in charge maintaining the data at the latest level and also cleaning it up after use.

总结一下,虽然有可能,但不建议这样做。虽然这可能适用于非常小的数据集,但这不能很好地扩展。适配器的设计是为您提供对数据/后端系统的事务访问。您应该按照设计的方式使用适配器。

To summarize, while it is possible, it is not recommended. While this may work in case of very small data set, this cannot scale well. The design of adapters is to provide you transactional access to data/backend systems. You should use the adapter the way it was designed to.

这篇关于MFP 8.0适配器缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆