定制 voceconnect/no-stampede-actions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

voceconnect/no-stampede-actions

Composer 安装命令:

composer require voceconnect/no-stampede-actions

包简介

A WordPress api to kick off globally singleton actions. It will lock the action to prevent other requests from kicking off the same action.

README 文档

README

Please note: This plugin is no longer being actively maintained or supported.

No Stampede Actions

Contributors: prettyboymp, kevinlangleyjr, csloisel
Tags: performance, caching
Requires at least: 3.0
Tested up to: 3.7.1
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Description

A WordPress api to kick off globally singleton actions. It will lock the action to prevent other requests from kicking off the same action

Installation

As theme or plugin dependency:

After dropping the plugin into the containing theme or plugin, add the following:

<?php
	if( ! class_exists( 'NSA_Action' ) ) {
		require_once( $path_to_nsa_actions . '/no-stampede-actions.php' );
	}

Usage

<?php
function long_request(){
	$val = wp_cache_get( 'long_request_key' );
	if( $val === false ){
		nsa_action('long_request')
			->action_callback( 'long_request_callback', array( 'http://example.com/long-running-request.php' ) )
			->background_only( false )
			->max_tries( 10 )
			->do_action( );

		$val = wp_cache_get( 'long_request_key' );
	}
	return $val;
}

function long_request_callback($url){
	$content = wp_remote_retrieve_body( wp_remote_get( $url, array( 'timeout' => 30 ) ) );
	wp_cache_set( 'long_request_key', $content );
	return $content;
}

统计信息

  • 总下载量: 1.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 14
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPLv2
  • 更新时间: 2013-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固