![]() |
Bearsampp 2026.9.23
|
Public Member Functions | |
| __construct ($id, $type) | |
| changePort ($port, $checkUsed=false, $wbProgressBar=null) | |
| checkPort ($port, $showWindow=false) | |
| getExe () | |
| getLog () | |
| getMemory () | |
| getPort () | |
| getService () | |
| rebuildConf () | |
| reload ($id=null, $type=null) | |
| setEnable ($enabled, $showWindow=false) | |
| setMemory ($memory) | |
| setPort ($port) | |
| setVersion ($version) | |
| switchVersion ($version, $showWindow=false) | |
| Public Member Functions inherited from Module | |
| __toString () | |
| getId () | |
| getName () | |
| getRelease () | |
| getType () | |
| getVersion () | |
| getVersionList () | |
| isEnable () | |
| update ($sub=0, $showWindow=false) | |
Data Fields | |
| const | LOCAL_CFG_EXE = 'memcachedExe' |
| const | LOCAL_CFG_MEMORY = 'memcachedMemory' |
| const | LOCAL_CFG_PORT = 'memcachedPort' |
| const | ROOT_CFG_ENABLE = 'memcachedEnable' |
| const | ROOT_CFG_VERSION = 'memcachedVersion' |
| const | SERVICE_NAME = 'bearsamppmemcached' |
| const | SERVICE_PARAMS = '-m %d -p %d -U 0 -vv' |
| Data Fields inherited from Module | |
| $currentPath | |
| $rootPath | |
| $symlinkPath | |
Protected Member Functions | |
| replaceAll ($params) | |
| updateConfig ($version=null, $sub=0, $showWindow=false) | |
| Protected Member Functions inherited from Module | |
| __construct () | |
| replace ($key, $value) | |
Private Attributes | |
| $exe | |
| $log | |
| $memory | |
| $port | |
| $service | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Module | |
| static | clearMemoryCache () |
| static | invalidateConfigCacheForPath ($sourcePath) |
| Protected Attributes inherited from Module | |
| $bearsamppConf | |
| $bearsamppConfRaw | |
| $enable | |
| $name | |
| $release = 'N/A' | |
| $version | |
Class BinMemcached
This class represents the Memcached service module in the Bearsampp application. It handles the configuration, initialization, and management of the Memcached service.
Definition at line 16 of file class.bin.memcached.php.
| __construct | ( | $id, | |
| $type ) |
Constructs a BinMemcached object and initializes the Memcached service.
| string | $id | The ID of the module. |
| string | $type | The type of the module. |
Definition at line 77 of file class.bin.memcached.php.
References Module\$id, Module\$type, Log\initClass(), and reload().
| changePort | ( | $port, | |
| $checkUsed = false, | |||
| $wbProgressBar = null ) |
Changes the port for the Memcached service.
| int | $port | The new port number. |
| bool | $checkUsed | Whether to check if the port is already in use. |
| mixed | $wbProgressBar | The progress bar object for UI updates. |
Definition at line 217 of file class.bin.memcached.php.
References $port, Log\debug(), Log\error(), Module\getName(), ServiceHelper\isPortInUse(), Util\isValidPort(), setPort(), and Module\update().
| checkPort | ( | $port, | |
| $showWindow = false ) |
Checks if the specified port is in use by the Memcached service.
| int | $port | The port number to check. |
| bool | $showWindow | Whether to show a message box with the result. |
Definition at line 256 of file class.bin.memcached.php.
References $bearsamppLang, $port, $response, Module\$version, APP_LOCALHOST, Lang\CHECK_PORT_TITLE, Log\debug(), Log\error(), Module\getName(), Util\isValidPort(), Lang\PORT_NOT_USED, Lang\PORT_NOT_USED_BY, and Lang\PORT_USED_BY.
| getExe | ( | ) |
Retrieves the executable file path for the Memcached service.
Definition at line 454 of file class.bin.memcached.php.
References $exe.
| getLog | ( | ) |
Retrieves the log file path for the Memcached service.
Definition at line 444 of file class.bin.memcached.php.
References $log.
| getMemory | ( | ) |
Retrieves the memory allocation for the Memcached service.
Definition at line 464 of file class.bin.memcached.php.
References $memory.
| getPort | ( | ) |
Retrieves the port number for the Memcached service.
Definition at line 484 of file class.bin.memcached.php.
References $port.
| getService | ( | ) |
Retrieves the service object for the Memcached service.
Definition at line 401 of file class.bin.memcached.php.
References $service.
| rebuildConf | ( | ) |
Rebuilds the configuration for the Memcached service in the Windows Registry.
Definition at line 187 of file class.bin.memcached.php.
References Registry\HKEY_LOCAL_MACHINE, and Nssm\INFO_APP_PARAMETERS.
| reload | ( | $id = null, | |
| $type = null ) |
Reloads the configuration and settings for the Memcached service.
| string | null | $id | The ID of the module. If null, the current ID is used. |
| string | null | $type | The type of the module. If null, the current type is used. |
Reimplemented from Module.
Definition at line 89 of file class.bin.memcached.php.
References $bearsamppConfig, $bearsamppLang, $bearsamppRoot, Module\$id, Module\$type, APP_TITLE, Log\error(), Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Lang\ERROR_INVALID_PARAMETER, Path\getLogsPath(), Module\getName(), Log\info(), Lang\MEMCACHED, Log\reloadClass(), and Nssm\SERVICE_DEMAND_START.
Referenced by __construct(), setEnable(), and setVersion().
|
protected |
Replaces multiple key-value pairs in the configuration file.
| array | $params | An associative array of key-value pairs to replace. |
Reimplemented from Module.
Definition at line 160 of file class.bin.memcached.php.
References Module\invalidateConfigCacheForPath().
| setEnable | ( | $enabled, | |
| $showWindow = false ) |
Enables or disables the Memcached service.
| bool | $enabled | Whether to enable or disable the service. |
| bool | $showWindow | Whether to show a message box with the result. |
Definition at line 412 of file class.bin.memcached.php.
References $bearsamppConfig, $bearsamppLang, Log\debug(), Config\DISABLED, Lang\ENABLE_BUNDLE_NOT_EXIST, Lang\ENABLE_TITLE, Config\ENABLED, Module\getName(), Module\getVersion(), Log\info(), ServiceHelper\installService(), reload(), and ServiceHelper\removeService().
| setMemory | ( | $memory | ) |
Sets the memory allocation for the Memcached service.
| int | $memory | The memory allocation in MB. |
Definition at line 474 of file class.bin.memcached.php.
References $memory, and Module\replace().
| setPort | ( | $port | ) |
Sets the port number for the Memcached service.
| int | $port | The port number. |
Definition at line 494 of file class.bin.memcached.php.
References $port, and Module\replace().
Referenced by changePort().
| setVersion | ( | $version | ) |
Sets the version of the Memcached service.
| string | $version | The version to set. |
Reimplemented from Module.
Definition at line 388 of file class.bin.memcached.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
| switchVersion | ( | $version, | |
| $showWindow = false ) |
Switches the version of the Memcached service.
| string | $version | The version to switch to. |
| bool | $showWindow | Whether to show a message box with the result. |
Definition at line 322 of file class.bin.memcached.php.
References Module\$version, Log\debug(), and updateConfig().
|
protected |
Updates the configuration for the Memcached service.
| string | null | $version | The version to update to. If null, the current version is used. |
| int | $sub | The sub-level for logging indentation. |
| bool | $showWindow | Whether to show a message box with the result. |
Reimplemented from Module.
Definition at line 338 of file class.bin.memcached.php.
References Module\$bearsamppConf, Module\$bearsamppConfRaw, $bearsamppLang, Module\$version, Lang\BEARSAMPP_CONF_MALFORMED_ERROR, Lang\BEARSAMPP_CONF_NOT_FOUND_ERROR, Log\debug(), Log\error(), Module\getName(), Module\getVersion(), setVersion(), and Lang\SWITCH_VERSION_TITLE.
Referenced by switchVersion().
|
private |
Definition at line 61 of file class.bin.memcached.php.
Referenced by getExe().
|
private |
Definition at line 56 of file class.bin.memcached.php.
Referenced by getLog().
|
private |
Definition at line 65 of file class.bin.memcached.php.
Referenced by getMemory(), and setMemory().
|
private |
Definition at line 69 of file class.bin.memcached.php.
Referenced by changePort(), checkPort(), getPort(), and setPort().
|
private |
Definition at line 52 of file class.bin.memcached.php.
Referenced by getService().
| const LOCAL_CFG_EXE = 'memcachedExe' |
Configuration key for the Memcached executable in the local configuration.
Definition at line 39 of file class.bin.memcached.php.
| const LOCAL_CFG_MEMORY = 'memcachedMemory' |
Configuration key for the Memcached memory allocation in the local configuration.
Definition at line 43 of file class.bin.memcached.php.
| const LOCAL_CFG_PORT = 'memcachedPort' |
Configuration key for the Memcached port in the local configuration.
Definition at line 47 of file class.bin.memcached.php.
| const ROOT_CFG_ENABLE = 'memcachedEnable' |
Configuration key for the Memcached enable flag in the root configuration.
Definition at line 30 of file class.bin.memcached.php.
| const ROOT_CFG_VERSION = 'memcachedVersion' |
Configuration key for the Memcached version in the root configuration.
Definition at line 34 of file class.bin.memcached.php.
| const SERVICE_NAME = 'bearsamppmemcached' |
The name of the Windows service.
Definition at line 21 of file class.bin.memcached.php.
Referenced by ActionService\__construct(), ServiceHelper\forceKillService(), TplAppMemcached\getActionInstallMemcachedService(), TplAppMemcached\getActionRemoveMemcachedService(), ServiceHelper\getAllServiceNames(), ActionQuit\getServiceDisplayName(), Bins\getServices(), ActionQuit\getServiceShutdownOrder(), ActionRestartAllServices\getServiceShutdownOrder(), ActionRestartAllServices\getServiceStartupOrder(), ServiceHelper\initializeMappings(), ActionStartup\prepareService(), and Win32Service\start().
| const SERVICE_PARAMS = '-m %d -p %d -U 0 -vv' |
The command line parameters passed to the Memcached service.
Definition at line 25 of file class.bin.memcached.php.