简体   繁体   中英

sharing .NET variables in php

I have an existing .NET application where most of the variables are stored using MemoryMappedFIles. I am merging this now existing php functionality.

The porblem is now how to access the .NET variables from within php. My current solution is based on implementing a pipe between both environments, but this does not hold when the load is high. Also, it is difficult to exchange structured data. I could try a relational database or a file in between, but this obviously adds overhead.

Any ideas on how to expose .NET variables into php ?

thanks.

If variables are going to be used across environments then a shared data store would be a good solution. I do not know too much about .NET variables, and how one might expose them, but it sounds like it might be a bad idea, or at least a hassle.

When sharing data across environments the idea is to think of the data as being stored in one central place:

[.NET]  [PHP]
      \ /
       |
    [Data]

This architecture is good because you keep stuff separated, which means that each component can be handled (ie optimized and scaled) individually. It also means that you can swap out, or add, components. For example, if you in a month decide to hire a group of Ruby developers to build some project then they will not have to worry about the other languages, they just need to connect to the data store and run with it.

As for what data store to use, it does not have to be files or a relation database; depending on the kind of data, you can use in-memory key/value stores like redis or memcached, or if the data is more structured then maybe a document database like MongoDB would fit better.

May be its not a good idea. Can you store those memory mapped variable value into cookies and

you can access those value using PHP cookie variable .

eg. $_COOKIE['variable name'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM