使用资源库/服务模式和MVC缓存数据对象(Caching Data Objects when using Repository/Service Pattern and MVC)
我有一个基于MVC的站点,它使用Repository / Service模式进行数据访问。 这些服务被写入大多数应用程序(控制台,winform和web)中。 目前,控制器直接与服务器通信。 这限制了应用适当缓存的能力。
我看到我的选择如下:
- 为Web应用程序编写一个包装器,实现了缓存的IWhatEverService。
- 通过缓存每个Action的ViewData,在每个控制器中应用缓存。
- 不要担心数据缓存,并且只为每个Action执行OutputCaching。
我可以看到每个人的利弊。 使用Repository / Service进行缓存的最佳做法是什么?
I have an MVC-based site, which is using a Repository/Service pattern for data access. The Services are written to be using in a majority of applications (console, winform, and web). Currently, the controllers communicate directly to the services. This has limited the ability to apply proper caching.
I see my options as the following:
- Write a wrapper for the web app, which implements the IWhatEverService which does caching.
- Apply caching in each controller by cache the ViewData for each Action.
- Don't worry about data caching and just implement OutputCaching for each Action.
I can see the pros and cons of each. What is/should the best practice be for caching with Repository/Service
原文:https://stackoverflow.com/questions/102913
最满意答案
我会严重怀疑这一点,考虑到它可能会导致DDOS到打印机。
I would seriously doubt this, considering it could be used to cause a DDOS to the printer.
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
当鼠标点击MDN时,您根本不需要任何关键事件来检测Shift , Ctrl和Alt 。 Event对象包含以下信息: element.addEventListener('click', function (e) { console.log(e.shiftKey); console.log(e.ctrlKey); console.log(e.altKey); }); 在jsFiddle演示 。 这些属性也可以在键盘事件处理程序中读取。 You don't need any key e ...
-
我会严重怀疑这一点,考虑到它可能会导致DDOS到打印机。 I would seriously doubt this, considering it could be used to cause a DDOS to the printer.
-
你可以这样做(jQuery的点击处理程序,但任何框架工作的重要部分): $(selector).click(function(e) { if(e.shiftKey) { //Shift-Click } if(e.ctrlKey) { //Ctrl+Click } if(e.altKey) { //Alt+Click } }); 只要处理任何你想要的内部, if在点击处理程序内,就像我上面。 You can do something like this (jQ ...
-
我最终使用Windows输入模拟器库。 适用于模拟按键和按键,包括shift,ctrl和alt键。 I ended up using the Windows Input Simulator library. Works well for simulating key-downs and key-ups, including the shift, ctrl and alt keys.
-
这可能有效: var x = 0, y = 0; $(document).bind('mousemove', function(event) {x = event.clientX; y = event.clientY;}); $(document).bind('mousewheel', function(e1) { var rand = Math.floor(Math.random*2) ? 1 : -1; X = x+rand; Y = y; setTimeout(fu ...
-
您将需要使用KeyListeners来挂钩“按下键”和“键释放”事件。 查看关于键掩码的链接 ,以确定是否按下了shift或ctrl (或任何键)。 You'll want to use KeyListeners to hook the "key pressed" and "key released" events. Check out this link about key masks to determine if shift or ctrl is pressed (or any key, for th ...
-
如何禁用Shift Ctrl?(How to disable Shift Ctrl?)[2023-08-03]
“^”是控制键的修饰符符号,Shift键是“+”。 修饰符符号仅用于修改其他键的键组合中。 也试试 +Ctrl Up:: return 要么 Shift & Ctrl Up:: return 编辑: 您可以更改或删除在控制面板 - >语言上更改键盘语言的组合,如下面的注释中所示。 "^" is the modifier symbol for the Control key and "+" for the Shift key. Modifier symbols are used only in key-c ... -
如何使用带修饰符的javascript单击方法(ctrl,shift)(How to use javascript click method with modifiers (ctrl, shift))[2022-07-19]
当您使用Control键单击时,它会发送contextmenu事件而不是click事件。 如果您想要所有类型的鼠标点击的一般事件,请使用mousedown 。 在没有jquery的情况下看看jquery的'trigger'方法相当于什么? 有关如何合成鼠标单击事件(包括所有不同事件参数)的更详细答案。 When ...