有没有Delphi的缓存框架? [英] Are there any Caching Frameworks for Delphi?

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

问题描述

问题: Delphi可以使用哪些缓存框架以及它们的发展程度?如果没有,那么有广泛接受的方式实现同​​样的目标吗?



问题详细信息:我查询的框架类型主要存在于Web开发框架中,允许用户:




  • 检查先前存储的数据/对象的缓存

  • 检索数据/对象

  • 存储新的数据/对象

  • 可选地标记数据/对象并标记它。

  • 根据一些标准(标签,标签,时间限制等)到期数据/对象。



我明白,没有RTTI的Delphi对象缺乏反思服务意味着它们可能不会以完全相同的方式存在,有没有一种类似的方法来实现至少部分相同的最终结果,在更多的Delphi方式?



替代方法:作为本地Delphi库的替代方法:是否有一组好的memcached或类似的绑定? / p>

解决方案

我已经使用 memcached (在Windows和MacOS上有几个版本,以及几乎任何其他操作系统),这很简单。



我处理了直接使用indy的TIDTelnet,通过阅读协议的文档,我只使用设置获取删除退出



我使用这种命令(我设置并获取名称,14是要存储的字节数):

  osama @ osama:〜$ telnet 127.0.0.1 11211 
尝试127.0.0.1 ...
连接到127.0.0.1。
转义字符为'^]。
设置名称0 0 14
Osama Alassiry
STORED
获取名称
值名称0 14
Osama Alassiry
END
退出

memcached允许您存储高达1 MB的缓存密钥,我使用复合键,如Person| 17 |名称','个人| 17 |图片','员工| 7 |工资|基本'(这些是与我真正做的无关的虚构名称)...我已经将缓存中的一些二进制文件存储为base64,使用高达768k的二进制数据。



memcached也可以通过散列密钥分散在几个服务器上,并根据哈希来选择几个服务器之一。 >

Question: What Caching Frameworks available for Delphi and how well developed are they? If there aren't any then is there a widely-accepted way of achieving the same objective? Applicable to Win32 targeting versions of Delphi.

Question Detail: The type of framework that I'm enquiring about exists largely in Web Development frameworks allowing the user to:

  • Check the Cache for previously stored Data/Object
  • Retrieve the Data/Object
  • Store the new Data/Object
  • Optionally tag the Data/Object and label it.
  • Expire Data/Objects based on some criteria (labels, tags, time limits etc).

I understand that a lack of reflection services for Delphi Objects without RTTI means that they probably won't exist in quite the same way but is there a similar way of achieving at least part of same end result in a more Delphi way?

Alternative Approach: As an alternative to a native Delphi library: Is there for example a good set of bindings for memcached or something similar?

解决方案

I have used memcached on Linux (there are versions on Windows and MacOS, as well as almost any other OS), It's quite simple.

I dealt with it directly, using indy's TIDTelnet, by reading the protocol's documentation, I only used set , get, delete, and quit.

I used this kind of commands (I set and get "name", 14 is the number of bytes to be stored):

osama@osama:~$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set name 0 0 14
Osama Alassiry
STORED
get name
VALUE name 0 14
Osama Alassiry
END
quit

memcached allows you to store up to 1MB per cache key, I used composite keys like 'Person|17|name', 'Person|17|picture', 'Employee|7|Salary|Basic' (these are fictitious names unrelated to what I really did) ... I have stored some binary files in the cache as base64 which allows to use up to 768k of binary data.

memcached can also be distributed on several servers by hashing the keys, and selecting one of several servers based on they hash.

这篇关于有没有Delphi的缓存框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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