@@ -3265,6 +3265,32 @@ static PHP_METHOD(Memcached, setSaslAuthData)
3265
3265
/* }}} */
3266
3266
#endif /* HAVE_MEMCACHED_SASL */
3267
3267
3268
+ #ifdef HAVE_MEMCACHED_SET_ENCODING_KEY
3269
+ /* {{{ Memcached::setEncodingKey(string key)
3270
+ Sets AES encryption key (libmemcached 1.0.6 and higher) */
3271
+ static PHP_METHOD (Memcached , setEncodingKey )
3272
+ {
3273
+ MEMC_METHOD_INIT_VARS ;
3274
+ memcached_return status ;
3275
+ zend_string * key ;
3276
+
3277
+ /* "S" */
3278
+ ZEND_PARSE_PARAMETERS_START (1 , 1 )
3279
+ Z_PARAM_STR (key )
3280
+ ZEND_PARSE_PARAMETERS_END ();
3281
+
3282
+ MEMC_METHOD_FETCH_OBJECT ;
3283
+
3284
+ status = memcached_set_encoding_key (intern -> memc , ZSTR_VAL (key ), ZSTR_LEN (key ));
3285
+
3286
+ if (s_memc_status_handle_result_code (intern , status ) == FAILURE ) {
3287
+ RETURN_FALSE ;
3288
+ }
3289
+ RETURN_TRUE ;
3290
+ }
3291
+ /* }}} */
3292
+ #endif /* HAVE_MEMCACHED_SET_ENCODING_KEY */
3293
+
3268
3294
/* {{{ Memcached::getResultCode()
3269
3295
Returns the result code from the last operation */
3270
3296
static PHP_METHOD (Memcached , getResultCode )
@@ -4282,6 +4308,15 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
4282
4308
REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_MSGPACK , 0 );
4283
4309
#endif
4284
4310
4311
+ /*
4312
+ * Indicate whether set_encoding_key is available
4313
+ */
4314
+ #ifdef HAVE_MEMCACHED_SET_ENCODING_KEY
4315
+ REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_ENCODING , 1 );
4316
+ #else
4317
+ REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_ENCODING , 0 );
4318
+ #endif
4319
+
4285
4320
#ifdef HAVE_MEMCACHED_SESSION
4286
4321
REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_SESSION , 1 );
4287
4322
#else
0 commit comments