Giter Site home page Giter Site logo

lua-resty-core's Introduction

Name

lua-resty-core - New FFI-based Lua API for ngx_http_lua_module and/or ngx_stream_lua_module

Table of Contents

Status

This library is production ready and under active development.

Synopsis

    # nginx.conf

    http {
        # you do NOT need to configure the following line when you
        # are using the OpenResty bundle 1.4.3.9+.
        lua_package_path "/path/to/lua-resty-core/lib/?.lua;;";

        init_by_lua_block {
            require "resty.core"
            collectgarbage("collect")  -- just to collect any garbage
        }

        ...
    }

Description

This pure Lua library reimplements part of the ngx_lua module's Nginx API for Lua with LuaJIT FFI and installs the new FFI-based Lua API into the ngx.* and ndk.* namespaces used by the ngx_lua module.

In addition, this Lua library implements any significant new Lua APIs of the ngx_lua module as proper Lua modules, like ngx.semaphore and ngx.balancer.

The FFI-based Lua API can work with LuaJIT's JIT compiler. ngx_lua's default API is based on the standard Lua C API, which will never be JIT compiled and the user Lua code is always interpreted (slowly).

Support for the new ngx_stream_lua_module has also begun.

This library is shipped with the OpenResty bundle by default. So you do not really need to worry about the dependencies and requirements.

Back to TOC

Prerequisites

WARNING This library is included with every OpenResty release. You should use the bundled version of this library in the particular OpenResty release you are using. Otherwise you may run into serious comaptibility issues.

Back to TOC

API Implemented

Back to TOC

resty.core.hash

Back to TOC

resty.core.base64

Back to TOC

resty.core.uri

Back to TOC

resty.core.regex

Back to TOC

resty.core.exit

Back to TOC

resty.core.shdict

resty.core.var

Back to TOC

resty.core.ctx

Back to TOC

resty.core.request

Back to TOC

resty.core.response

Back to TOC

resty.core.misc

Back to TOC

resty.core.time

Back to TOC

resty.core.worker

Back to TOC

ngx.semaphore

This Lua module implements a semaphore API for efficient "light thread" synchronization, which can work across different requests (but not across nginx worker processes).

See the documentation for this Lua module for more details.

Back to TOC

ngx.balancer

This Lua module implements for defining dynamic upstream balancers in Lua.

See the documentation for this Lua module for more details.

Back to TOC

ngx.ssl

This Lua module provides a Lua API for controlling SSL certificates, private keys, SSL protocol versions, and etc in NGINX downstream SSL handshakes.

See the documentation for this Lua module for more details.

Back to TOC

ngx.ssl.session

This Lua module provides a Lua API for manipulating SSL session data and IDs for NGINX downstream SSL connections.

See the documentation for this Lua module for more details.

Back to TOC

ngx.re

This Lua module provides a Lua API which implements convenience utilities for the ngx.re API.

See the documentation for this Lua module for more details.

Back to TOC

ngx.process

This Lua module is used to manage the nginx process in Lua.

See the documentation for this Lua module for more details.

This module was first introduced in lua-resty-core v0.1.12.

Back to TOC

ngx.errlog

This Lua module provides Lua API to capture and manage nginx error log messages.

See the documentation for this Lua module for more details.

This module was first introduced in lua-resty-core v0.1.12.

Back to TOC

Caveat

If the user Lua code is not JIT compiled, then use of this library may lead to performance drop in interpreted mode. You will only observe speedup when you get a good part of your user Lua code JIT compiled.

Back to TOC

TODO

  • Re-implement ngx_lua's cosocket API with FFI.
  • Re-implement ngx_lua's ngx.get_phase API function with FFI.
  • Re-implement ngx_lua's ngx.eof and ngx.flush API functions with FFI.

Back to TOC

Author

Yichun "agentzh" Zhang (章亦春) [email protected], OpenResty Inc.

Back to TOC

Copyright and License

This module is licensed under the BSD license.

Copyright (C) 2013-2017, by Yichun "agentzh" Zhang, OpenResty Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Back to TOC

See Also

Back to TOC

lua-resty-core's People

Contributors

agentzh avatar thibaultcha avatar membphis avatar spacewander avatar alubbe avatar doujiang24 avatar chipitsine avatar moonming avatar ghedo avatar pushrax avatar p0pr0ck5 avatar noname007 avatar bungle avatar tonyo avatar dndx avatar jsopenrb avatar hnakamur avatar pracj3am avatar jdesgats avatar tmthrgd avatar chronolaw avatar cuiweixie avatar detailyang avatar ms2008 avatar subnetmarco avatar xiaoxuanzi avatar halfcrazy avatar

Watchers

James Cloos avatar hzqtx 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.