Giter Club home page Giter Club logo

ngx_shm_dict's Introduction

nginx共享内存

根据配置文件来动态的添加共享内存。

ngx_shm_dict

共享内存核心模块(红黑树,队列)

ngx_shm_dict_manager

添加定时器事件,定时的清除共享内存中过期的key

添加读事件,支持redis协议,通过redis-cli get,set,del,ttl

ngx_shm_dict_view

共享内存查看

Install

Linux

git clone https://github.com/lidaohang/ngx_shm_dict
git clone https://github.com/lidaohang/ngx_shm_manager
git clone https://github.com/lidaohang/ngx_shm_dict_view

patch -p1 < ngx_shm_manager/nginx-1.4.1-1.58-proc-module.patch

./configure --add-module=ngx_shm_dict --add-module=ngx_shm_dict_view --add-module=ngx_shm_dict_manager
make && make install

相关模块

git clone https://github.com/lidaohang/ngx_shm_dict   			核心模块
git clone https://github.com/lidaohang/ngx_shm_manager			管理以及主动过期策略,支持redis协议
git clone https://github.com/lidaohang/ngx_shm_dict_view		查看共享内存

Example


processes {

	process ngx_shm_dict_manager {
	    ngx_shm_dict_name test;
	    interval 3s;
	
	    delay_start 300ms;
	    listen 8010;
	}
}


    ngx_shm_dict_zone zone=test max_size=2048m;
    ngx_shm_dict_zone zone=test1 max_size=2048m;
    
    ngx_shm_dict_zone zone=test2 max_size=2048m;
    ngx_shm_dict_zone zone=test3 max_size=2048m;


    server {
        listen       8011;
        server_name  localhost;

		location / {
            ngx_shm_dict_view;
		}
    }

Test

curl "http://127.0.0.1:8011/set?zone=test&key=abc&value=123&exptime=100"
curl "http://127.0.0.1:8011/get?zone=test&key=abc"
curl "http://127.0.0.1:8011/del?zone=test&key=abc"


redis-cli get abc
redis-cli set abc 123
redis-cli del abc
redis-cli ttl abc
	

ngx_shm_dict's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.