memcachedplugin.hpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2014 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef ECL_MEMCACHED_INCL
  14. #define ECL_MEMCACHED_INCL
  15. #ifdef _WIN32
  16. #define ECL_MEMCACHED_CALL _cdecl
  17. #ifdef ECL_MEMCACHED_EXPORTS
  18. #define ECL_MEMCACHED_API __declspec(dllexport)
  19. #else
  20. #define ECL_MEMCACHED_API __declspec(dllimport)
  21. #endif
  22. #else
  23. #define ECL_MEMCACHED_CALL
  24. #define ECL_MEMCACHED_API
  25. #endif
  26. #include "hqlplugins.hpp"
  27. #include "eclhelper.hpp"
  28. extern "C"
  29. {
  30. ECL_MEMCACHED_API bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb);
  31. ECL_MEMCACHED_API void setPluginContext(IPluginContext * _ctx);
  32. }
  33. //NB: LIBMEMCACHED_API already used by libmemcached
  34. extern "C++"
  35. {
  36. namespace MemCachedPlugin {
  37. //--------------------------SET----------------------------------------
  38. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSet (ICodeContext * _ctx, const char * key, bool value, const char * options, const char * partitionKey, unsigned __int64 expire);
  39. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSet (ICodeContext * _ctx, const char * key, signed __int64 value, const char * options, const char * partitionKey, unsigned __int64 expire);
  40. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSet (ICodeContext * _ctx, const char * key, unsigned __int64 value, const char * options, const char * partitionKey, unsigned __int64 expire);
  41. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSet (ICodeContext * _ctx, const char * key, double value, const char * options, const char * partitionKey, unsigned __int64 expire);
  42. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSetUtf8(ICodeContext * _ctx, const char * key, size32_t valueLength, const char * value, const char * options, const char * partitionKey, unsigned __int64 expire);
  43. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSet (ICodeContext * _ctx, const char * key, size32_t valueLength, const char * value, const char * options, const char * partitionKey, unsigned __int64 expire);
  44. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSet (ICodeContext * _ctx, const char * key, size32_t valueLength, const UChar * value, const char * options, const char * partitionKey, unsigned __int64 expire);
  45. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MSetData(ICodeContext * _ctx, const char * key, size32_t valueLength, const void * value, const char * options, const char * partitionKey, unsigned __int64 expire);
  46. //--------------------------GET----------------------------------------
  47. ECL_MEMCACHED_API bool ECL_MEMCACHED_CALL MGetBool (ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  48. ECL_MEMCACHED_API signed __int64 ECL_MEMCACHED_CALL MGetInt8 (ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  49. ECL_MEMCACHED_API unsigned __int64 ECL_MEMCACHED_CALL MGetUint8 (ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  50. ECL_MEMCACHED_API double ECL_MEMCACHED_CALL MGetDouble(ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  51. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MGetUtf8 (ICodeContext * _ctx, size32_t & valueLength, char * & returnValue, const char * key, const char * options, const char * partitionKey);
  52. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MGetStr (ICodeContext * _ctx, size32_t & valueLength, char * & returnValue, const char * key, const char * options, const char * partitionKey);
  53. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MGetUChar (ICodeContext * _ctx, size32_t & valueLength, UChar * & returnValue, const char * key, const char * options, const char * partitionKey);
  54. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MGetData (ICodeContext * _ctx,size32_t & returnLength, void * & returnValue, const char * key, const char * options, const char * partitionKey);
  55. //--------------------------------AUXILLARIES---------------------------
  56. ECL_MEMCACHED_API bool ECL_MEMCACHED_CALL MExists (ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  57. ECL_MEMCACHED_API const char * ECL_MEMCACHED_CALL MKeyType(ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  58. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MClear (ICodeContext * _ctx, const char * options);
  59. ECL_MEMCACHED_API void ECL_MEMCACHED_CALL MDelete (ICodeContext * _ctx, const char * key, const char * options, const char * partitionKey);
  60. }//close namespace
  61. }
  62. #endif