Apache C ++模块持久性全局对象 [英] Apache C++ module persistent global objects

查看:50
本文介绍了Apache C ++模块持久性全局对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使Apache C ++模块中的某些全局对象在Apache子进程调用之间保持持久性.我该怎么办?

解决方案

您必须在Apache进程外部使用某种形式的存储.

基本选择:

  • 数据库.
  • 共享内存(取决于操作系统).
  • 另一个过程,并使用IPC机制(例如套接字)
  • 文件.

哪种才是合适的取决于您的要求,您可以将它们组合在一起.例如,数据库"实际上是作为另一个使文件保持持久性并以已知方式处理并发问题的过程而实现的.

通常,数据库可能是首先尝试的方法,只有在您可以通过采用其他方法解决特定问题的情况下,才尝试使用其他方法.

I want to keep some global objects in an Apache C++ module persistent across Apache child process invocations. How do I do this?

解决方案

You must use some form of storage external to the Apache processes.

Basic choices:

  • A database.
  • Shared memory (OS dependent).
  • Another process and use an IPC mechanism (eg. a socket)
  • A file.

Which one is appropriate depends on your requirements, and you might combine them. For example, "a database" is actually implemented as another process that makes things persistent in a file and it deals with concurrency issues in a known way.

In general, a database is probably the first thing to try and only go to other alternatives if you have specific issues that can be solved by taking a different approach.

这篇关于Apache C ++模块持久性全局对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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